You are here

public function WorkspaceManager::isEntityTypeSupported in Drupal 8

Same name and namespace in other branches
  1. 9 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 144

Class

WorkspaceManager
Provides the workspace manager.

Namespace

Drupal\workspaces

Code

public function isEntityTypeSupported(EntityTypeInterface $entity_type) {

  // First, check if we already determined whether this entity type is
  // supported or not.
  if (isset($this->blacklist[$entity_type
    ->id()])) {
    return FALSE;
  }
  if ($entity_type
    ->entityClassImplements(EntityPublishedInterface::class) && $entity_type
    ->isRevisionable()) {
    return TRUE;
  }

  // This entity type can not belong to a workspace, add it to the blacklist.
  $this->blacklist[$entity_type
    ->id()] = $entity_type
    ->id();
  return FALSE;
}