contact_storage_test.install
Same filename in other branches
File
-
core/
modules/ contact/ tests/ modules/ contact_storage_test/ contact_storage_test.install
View source
<?php
/**
* @file
* Contains install and update hooks.
*/
declare (strict_types=1);
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
/**
* Implements hook_install().
*/
function contact_storage_test_install() : void {
$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);
}
Functions
Title | Deprecated | Summary |
---|---|---|
contact_storage_test_install | Implements hook_install(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.