
| Current Path : /var/www/html/strat/web/core/modules/system/tests/modules/module_test/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/web/core/modules/system/tests/modules/module_test/module_test.install |
<?php
/**
* @file
* Install, update and uninstall functions for the module_test module.
*/
use Drupal\Core\Database\Database;
/**
* Implements hook_schema().
*/
function module_test_schema() {
$schema['module_test'] = [
'description' => 'Dummy table to test the behavior of hook_schema() during module installation.',
'fields' => [
'data' => [
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'An example data column for the module.',
],
],
];
return $schema;
}
/**
* Implements hook_install().
*/
function module_test_install() {
$schema = module_test_schema()['module_test'];
Database::getConnection()->insert('module_test')
->fields([
'data' => $schema['fields']['data']['type'],
])
->execute();
if (\Drupal::state()->get('module_test_install:rebuild_container')) {
// Ensure that the container can be rebuilt during hook_install(). Doing
// this in hook_install() is bad practice but it should not break anything.
\Drupal::service('kernel')->rebuildContainer();
}
}