You are here

public function WorkspaceManager::isEntityTypeSupported in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workspaces/src/WorkspaceManager.php \Drupal\workspaces\WorkspaceManager::isEntityTypeSupported()

Returns whether an entity type can belong to a workspace or not.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to check.

Return value

bool TRUE if the entity type can belong to a workspace, FALSE otherwise.

Overrides WorkspaceManagerInterface::isEntityTypeSupported

2 calls to WorkspaceManager::isEntityTypeSupported()
WorkspaceManager::getSupportedEntityTypes in core/modules/workspaces/src/WorkspaceManager.php
Returns an array of entity types that can belong to workspaces.
WorkspaceManager::shouldAlterOperations in core/modules/workspaces/src/WorkspaceManager.php
Determines whether runtime entity operations should be altered.

File

core/modules/workspaces/src/WorkspaceManager.php, line 140

Class

WorkspaceManager
Provides the workspace manager.

Namespace

Drupal\workspaces

Code

public function isEntityTypeSupported(EntityTypeInterface $entity_type) {
  $entity_type_id = $entity_type
    ->id();
  if (!isset($this->supported[$entity_type_id])) {

    // Only entity types which are revisionable and publishable can belong
    // to a workspace.
    $this->supported[$entity_type_id] = $entity_type
      ->entityClassImplements(EntityPublishedInterface::class) && $entity_type
      ->isRevisionable();
  }
  return $this->supported[$entity_type_id];
}