function EntityOperations::shouldSkipOperations

Same name in this branch
  1. 11.x core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::shouldSkipOperations()
Same name in other branches
  1. 10 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::shouldSkipOperations()

Determines whether we need to react on entity operations.

Parameters

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

Return value

bool Returns TRUE if entity operations should not be altered, FALSE otherwise.

5 calls to EntityOperations::shouldSkipOperations()
EntityOperations::entityInsert in core/modules/workspaces/src/Hook/EntityOperations.php
Implements hook_entity_insert().
EntityOperations::entityPredelete in core/modules/workspaces/src/Hook/EntityOperations.php
Implements hook_entity_predelete().
EntityOperations::entityPresave in core/modules/workspaces/src/Hook/EntityOperations.php
Implements hook_entity_presave().
EntityOperations::entityTranslationInsert in core/modules/workspaces/src/Hook/EntityOperations.php
Implements hook_entity_translation_insert().
EntityOperations::entityUpdate in core/modules/workspaces/src/Hook/EntityOperations.php
Implements hook_entity_update().

File

core/modules/workspaces/src/Hook/EntityOperations.php, line 313

Class

EntityOperations
Defines a class for reacting to entity runtime hooks.

Namespace

Drupal\workspaces\Hook

Code

protected function shouldSkipOperations(EntityInterface $entity) : bool {
    // We should not react on entity operations when the entity is ignored or
    // when we're not in a workspace context.
    return $this->workspaceInfo
        ->isEntityIgnored($entity) || !$this->workspaceManager
        ->hasActiveWorkspace();
}

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