function WorkspaceInformation::isEntitySupported

Determines whether an entity can belong to a workspace.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to check.

Return value

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

Overrides WorkspaceInformationInterface::isEntitySupported

File

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

Class

WorkspaceInformation
General service for workspace support information.

Namespace

Drupal\workspaces

Code

public function isEntitySupported(EntityInterface $entity) : bool {
  $entity_type = $entity->getEntityType();
  if (!$this->isEntityTypeSupported($entity_type)) {
    return FALSE;
  }
  $handler = $this->entityTypeManager
    ->getHandler($entity_type->id(), 'workspace');
  return $handler->isEntitySupported($entity);
}

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