function keyvalue_test_entity_type_alter

Same name in other branches
  1. 9 core/modules/system/tests/modules/keyvalue_test/keyvalue_test.module \keyvalue_test_entity_type_alter()
  2. 8.9.x core/modules/system/tests/modules/keyvalue_test/keyvalue_test.module \keyvalue_test_entity_type_alter()
  3. 10 core/modules/system/tests/modules/keyvalue_test/keyvalue_test.module \keyvalue_test_entity_type_alter()

Implements hook_entity_type_alter().

File

core/modules/system/tests/modules/keyvalue_test/keyvalue_test.module, line 13

Code

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

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