You are here

protected function EntityOperations::shouldSkipPreOperations in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::shouldSkipPreOperations()

Determines whether we need to react on pre-save or pre-delete operations.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type to check.

Return value

bool Returns TRUE if the pre-save or pre-delete entity operations should not be altered in the current request, FALSE otherwise.

2 calls to EntityOperations::shouldSkipPreOperations()
EntityOperations::entityPredelete in core/modules/workspaces/src/EntityOperations.php
Acts on an entity before it is deleted.
EntityOperations::entityPresave in core/modules/workspaces/src/EntityOperations.php
Acts on an entity before it is created or updated.

File

core/modules/workspaces/src/EntityOperations.php, line 305

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\workspaces

Code

protected function shouldSkipPreOperations(EntityTypeInterface $entity_type) {

  // We should not react on pre-save and pre-delete entity operations if one
  // of the following conditions are met:
  // - the entity type is provided by the Workspaces module;
  // - the entity type is internal, which means that it should not affect
  //   anything in the default (Live) workspace;
  // - we are in the default workspace.
  return $entity_type
    ->getProvider() === 'workspaces' || $entity_type
    ->isInternal() || !$this->workspaceManager
    ->hasActiveWorkspace();
}