You are here

public function EntityTypeInfo::entityTypeAlter in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/EntityTypeInfo.php \Drupal\workbench_moderation\EntityTypeInfo::entityTypeAlter()

Adds Moderation configuration to appropriate entity types.

This is an alter hook bridge.

Parameters

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

See also

hook_entity_type_alter()

File

src/EntityTypeInfo.php, line 84

Class

EntityTypeInfo
Service class for manipulating entity type information.

Namespace

Drupal\workbench_moderation

Code

public function entityTypeAlter(array &$entity_types) {
  foreach ($this->moderationInfo
    ->selectRevisionableEntityTypes($entity_types) as $type_name => $type) {
    $entity_types[$type_name] = $this
      ->addModerationToEntityType($type);
    $entity_types[$type
      ->get('bundle_of')] = $this
      ->addModerationToEntity($entity_types[$type
      ->get('bundle_of')]);
  }
}