function EntityOperations::entityUpdate
Same name in this branch
- 11.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityUpdate()
- 11.x core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityUpdate()
Same name in other branches
- 9 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityUpdate()
- 9 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityUpdate()
- 8.9.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityUpdate()
- 8.9.x core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityUpdate()
- 10 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityUpdate()
- 10 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityUpdate()
Implements hook_entity_update().
File
-
core/
modules/ workspaces/ src/ Hook/ EntityOperations.php, line 166
Class
- EntityOperations
- Defines a class for reacting to entity runtime hooks.
Namespace
Drupal\workspaces\HookCode
public function entityUpdate(EntityInterface $entity) : void {
if ($entity->getEntityTypeId() === 'workspace') {
$this->workspaceRepository
->resetCache();
}
if ($this->shouldSkipOperations($entity) || !$this->workspaceInfo
->isEntitySupported($entity)) {
return;
}
// Only track new revisions.
/** @var \Drupal\Core\Entity\RevisionableInterface $entity */
if ($entity->getLoadedRevisionId() != $entity->getRevisionId()) {
$this->workspaceAssociation
->trackEntity($entity, $this->workspaceManager
->getActiveWorkspace());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.