function WorkspaceInformation::isEntityTypeSupported

Determines whether an entity type can belong to a workspace.

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 WorkspaceInformationInterface::isEntityTypeSupported

2 calls to WorkspaceInformation::isEntityTypeSupported()
WorkspaceInformation::getSupportedEntityTypes in core/modules/workspaces/src/WorkspaceInformation.php
Returns an array of entity types that can belong to workspaces.
WorkspaceInformation::isEntitySupported in core/modules/workspaces/src/WorkspaceInformation.php
Determines whether an entity can belong to a workspace.

File

core/modules/workspaces/src/WorkspaceInformation.php, line 52

Class

WorkspaceInformation
General service for workspace support information.

Namespace

Drupal\workspaces

Code

public function isEntityTypeSupported(EntityTypeInterface $entity_type) : bool {
  if (!isset($this->supported[$entity_type->id()])) {
    if ($entity_type->hasHandlerClass('workspace')) {
      $supported = !is_a($entity_type->getHandlerClass('workspace'), IgnoredWorkspaceHandler::class, TRUE);
    }
    else {
      // Fallback for cases when entity type info hasn't been altered yet, for
      // example when the Workspaces module is being installed.
      $supported = $entity_type->entityClassImplements(EntityPublishedInterface::class) && $entity_type->isRevisionable();
    }
    $this->supported[$entity_type->id()] = $supported;
  }
  return $this->supported[$entity_type->id()];
}

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