function WorkspaceSafeFormTrait::isWorkspaceSafeEntityType

Same name in other branches
  1. 10 core/lib/Drupal/Core/Entity/Form/WorkspaceSafeFormTrait.php \Drupal\Core\Entity\Form\WorkspaceSafeFormTrait::isWorkspaceSafeEntityType()

Determines whether an entity type used in a form is workspace-safe.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: An entity type object.

Return value

bool TRUE if the entity type is workspace-safe, FALSE otherwise.

2 calls to WorkspaceSafeFormTrait::isWorkspaceSafeEntityType()
BulkForm::isWorkspaceSafeForm in core/modules/views/src/Plugin/views/field/BulkForm.php
Determines whether the form is safe to be submitted in a workspace.
DeleteMultipleForm::isWorkspaceSafeForm in core/lib/Drupal/Core/Entity/Form/DeleteMultipleForm.php
Determines whether the form is safe to be submitted in a workspace.

File

core/lib/Drupal/Core/Entity/Form/WorkspaceSafeFormTrait.php, line 48

Class

WorkspaceSafeFormTrait
Provides helpers for checking whether objects in forms are workspace-safe.

Namespace

Drupal\Core\Entity\Form

Code

protected function isWorkspaceSafeEntityType(EntityTypeInterface $entity_type) : bool {
    if (!\Drupal::hasService('workspaces.information')) {
        return FALSE;
    }
    $is_supported = $this->getWorkspaceInfo()
        ->isEntityTypeSupported($entity_type);
    $is_ignored = $this->getWorkspaceInfo()
        ->isEntityTypeIgnored($entity_type);
    return $is_supported || $is_ignored;
}

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