function EntityOperations::shouldSkipPreOperations
Same name in other branches
- 8.9.x 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\workspacesCode
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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.