You are here

function contact_storage_test_entity_type_alter in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module \contact_storage_test_entity_type_alter()
  2. 9 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
Contains custom contact message functionality for ContactStorageTest.

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');
}