function EntityTypeInfo::entityTypeBuild

Same name and namespace in other branches
  1. 8.9.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeBuild()
  2. 10 core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeBuild()
  3. 11.x core/modules/workspaces/src/EntityTypeInfo.php \Drupal\workspaces\EntityTypeInfo::entityTypeBuild()

Adds the "EntityWorkspaceConflict" constraint to eligible entity types.

Parameters

\Drupal\Core\Entity\EntityTypeInterface[] $entity_types: An associative array of all entity type definitions, keyed by the entity type name. Passed by reference.

See also

hook_entity_type_build()

File

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

Class

EntityTypeInfo
Manipulates entity type information.

Namespace

Drupal\workspaces

Code

public function entityTypeBuild(array &$entity_types) {
    foreach ($entity_types as $entity_type) {
        if ($this->workspaceManager
            ->isEntityTypeSupported($entity_type)) {
            $entity_type->addConstraint('EntityWorkspaceConflict');
            $entity_type->setRevisionMetadataKey('workspace', 'workspace');
        }
    }
}

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