function EntityTypeInfo::entityTypeAlter

Same name in this branch
  1. 9 core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityTypeAlter()
Same name and namespace in other branches
  1. 8.9.x core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityTypeAlter()
  2. 8.9.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeAlter()
  3. 10 core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityTypeAlter()
  4. 10 core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeAlter()
  5. 11.x core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityTypeAlter()
  6. 11.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeAlter()

Removes the 'latest-version' link template provided by Content Moderation.

Parameters

\Drupal\Core\Entity\EntityTypeInterface[] $entity_types: An array of entity types.

See also

hook_entity_type_alter()

File

core/modules/workspaces/src/EntityTypeInfo.php, line 85

Class

EntityTypeInfo
Manipulates entity type information.

Namespace

Drupal\workspaces

Code

public function entityTypeAlter(array &$entity_types) {
    foreach ($entity_types as $entity_type) {
        // Non-default workspaces display the active revision on the canonical
        // route of an entity, so the latest version route is no longer needed.
        $link_templates = $entity_type->get('links');
        unset($link_templates['latest-version']);
        $entity_type->set('links', $link_templates);
    }
}

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