function WorkspaceInformation::isEntityIgnored

Same name and namespace in other branches
  1. 11.x core/modules/workspaces/src/WorkspaceInformation.php \Drupal\workspaces\WorkspaceInformation::isEntityIgnored()

Determines whether CRUD operations for an entity are allowed.

CRUD operations for an ignored entity are allowed in a workspace, but their revisions are not tracked.

Parameters

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

Return value

bool TRUE if CRUD operations of an entity type can safely be done inside a workspace, without impacting the Live site, FALSE otherwise.

Overrides WorkspaceInformationInterface::isEntityIgnored

File

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

Class

WorkspaceInformation
General service for workspace support information.

Namespace

Drupal\workspaces

Code

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

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