function contact_storage_test_install
Same name in other branches
- 8.9.x core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.install \contact_storage_test_install()
- 10 core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.install \contact_storage_test_install()
- 11.x core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.install \contact_storage_test_install()
Implements hook_install().
File
-
core/
modules/ contact/ tests/ modules/ contact_storage_test/ contact_storage_test.install, line 13
Code
function contact_storage_test_install() {
$entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager();
$original = $entity_definition_update_manager->getEntityType('contact_message');
$entity_definition_update_manager->uninstallEntityType($original);
// Update the entity type definition and make it use the default SQL storage.
// @see contact_storage_test_entity_type_alter()
$entity_type = clone $original;
$entity_type->setStorageClass(SqlContentEntityStorage::class);
$keys = $entity_type->getKeys();
$keys['id'] = 'id';
$entity_type->set('entity_keys', $keys);
$entity_type->set('base_table', 'contact_message');
$entity_definition_update_manager->installEntityType($entity_type);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.