function WorkspaceInformation::isEntityDeletable

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

Determines whether an entity can be deleted in the given workspace.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object which needs to be checked.

\Drupal\workspaces\WorkspaceInterface $workspace: The workspace in which the entity needs to be checked.

Return value

bool TRUE if the entity can be deleted, FALSE otherwise.

Overrides WorkspaceInformationInterface::isEntityDeletable

File

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

Class

WorkspaceInformation
General service for workspace support information.

Namespace

Drupal\workspaces

Code

public function isEntityDeletable(EntityInterface $entity, WorkspaceInterface $workspace) : bool {
  $initial_revisions = $this->workspaceAssociation
    ->getAssociatedInitialRevisions($workspace->id(), $entity->getEntityTypeId());
  return in_array($entity->id(), $initial_revisions, TRUE);
}

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