function EntityTypeInfo::entityTypeAlter
Same name in this branch
- 11.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeAlter()
Same name in other branches
- 9 core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityTypeAlter()
- 9 core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeAlter()
- 8.9.x core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityTypeAlter()
- 8.9.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeAlter()
- 10 core/modules/content_moderation/src/EntityTypeInfo.php \Drupal\content_moderation\EntityTypeInfo::entityTypeAlter()
- 10 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
File
-
core/
modules/ content_moderation/ src/ EntityTypeInfo.php, line 134
Class
- EntityTypeInfo
- Manipulates entity type information.
Namespace
Drupal\content_moderationCode
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.
// Workspace entities can not be moderated because they use string IDs.
// @see \Drupal\content_moderation\Entity\ContentModerationState::baseFieldDefinitions()
// where the target entity ID is defined as an integer.
// @todo Moderation is disabled for taxonomy terms until integration is
// enabled for them.
// @see https://www.drupal.org/project/drupal/issues/3047110
$entity_type_to_exclude = [
'path_alias',
'workspace',
];
if ($entity_type->isRevisionable() && !$entity_type->isInternal() && !in_array($entity_type_id, $entity_type_to_exclude)) {
$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.