class KeyvalueTestHooks

Hook implementations for keyvalue_test.

Hierarchy

Expanded class hierarchy of KeyvalueTestHooks

File

core/modules/system/tests/modules/keyvalue_test/src/Hook/KeyvalueTestHooks.php, line 12

Namespace

Drupal\keyvalue_test\Hook
View source
class KeyvalueTestHooks {
    
    /**
     * Implements hook_entity_type_alter().
     */
    public function entityTypeAlter(array &$entity_types) : void {
        
        /** @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.