function EntityTestUpdateHooks::entityTypeAlter

Implements hook_entity_type_alter().

File

core/modules/system/tests/modules/entity_test_update/src/Hook/EntityTestUpdateHooks.php, line 47

Class

EntityTestUpdateHooks
Hook implementations for entity_test_update.

Namespace

Drupal\entity_test_update\Hook

Code

public function entityTypeAlter(array &$entity_types) : void {
    // Allow entity_test_update tests to override the entity type definition.
    $entity_type = \Drupal::state()->get('entity_test_update.entity_type', $entity_types['entity_test_update']);
    if ($entity_type !== 'null') {
        $entity_types['entity_test_update'] = $entity_type;
    }
    else {
        unset($entity_types['entity_test_update']);
    }
}

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