function EntityTypeInfo::entityTypeAlter

Same name in this branch
  1. 8.9.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeAlter()
Same name and namespace in other branches
  1. 9 core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityTypeAlter()
  2. 9 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()

Adds Moderation configuration to appropriate entity types.

Parameters

\Drupal\Core\Entity\EntityTypeInterface[] $entity_types: The master entity type list to alter.

See also

hook_entity_type_alter()

File

core/modules/content_moderation/src/EntityTypeInfo.php, line 130

Class

EntityTypeInfo
Manipulates entity type information.

Namespace

Drupal\content_moderation

Code

public function entityTypeAlter(array &$entity_types) {
    foreach ($entity_types as $entity_type_id => $entity_type) {
        // Internal entity types should never be moderated, and the 'path_alias'
        // entity type needs to be excluded for now.
        // @todo Enable moderation for path aliases after they become publishable
        //   in https://www.drupal.org/project/drupal/issues/3007669.
        if ($entity_type->isRevisionable() && !$entity_type->isInternal() && $entity_type_id !== 'path_alias') {
            $entity_types[$entity_type_id] = $this->addModerationToEntityType($entity_type);
        }
    }
}

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