function contact_storage_test_entity_type_alter

Same name in other branches
  1. 8.9.x core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module \contact_storage_test_entity_type_alter()
  2. 10 core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module \contact_storage_test_entity_type_alter()
  3. 11.x core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module \contact_storage_test_entity_type_alter()

Implements hook_entity_type_alter().

File

core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module, line 33

Code

function contact_storage_test_entity_type_alter(array &$entity_types) {
    
    /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
    // Set the controller class for nodes to an alternate implementation of the
    // Drupal\Core\Entity\EntityStorageInterface interface.
    $entity_types['contact_message']->setStorageClass('\\Drupal\\Core\\Entity\\Sql\\SqlContentEntityStorage');
    $keys = $entity_types['contact_message']->getKeys();
    $keys['id'] = 'id';
    $entity_types['contact_message']->set('entity_keys', $keys);
    $entity_types['contact_message']->set('base_table', 'contact_message');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.