function module_test_install
Same name in other branches
- 7.x modules/simpletest/tests/module_test.install \module_test_install()
- 9 core/modules/system/tests/modules/module_test/module_test.install \module_test_install()
- 8.9.x core/modules/system/tests/modules/module_test/module_test.install \module_test_install()
- 11.x core/modules/system/tests/modules/module_test/module_test.install \module_test_install()
Implements hook_install().
File
-
core/
modules/ system/ tests/ modules/ module_test/ module_test.install, line 32
Code
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();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.