keyvalue_test.module in Drupal 9
Same filename and directory in other branches
Sets up the key value entity storage.
File
core/modules/system/tests/modules/keyvalue_test/keyvalue_test.moduleView source
<?php
/**
* @file
* Sets up the key value entity storage.
*/
/**
* Implements hook_entity_type_alter().
*/
function keyvalue_test_entity_type_alter(array &$entity_types) {
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
if (isset($entity_types['entity_test_label'])) {
$entity_types['entity_test_label']
->setStorageClass('Drupal\\Core\\Entity\\KeyValueStore\\KeyValueContentEntityStorage');
$entity_keys = $entity_types['entity_test_label']
->getKeys();
$entity_types['entity_test_label']
->set('entity_keys', $entity_keys + [
'uuid' => 'uuid',
]);
$entity_types['entity_test_label']
->set('provider', 'keyvalue_test');
}
}
Functions
Name | Description |
---|---|
keyvalue_test_entity_type_alter | Implements hook_entity_type_alter(). |