public function EntityOperations::entityUpdate in Drupal 8
Same name in this branch
- 8 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityUpdate()
- 8 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityUpdate()
Same name and namespace in other branches
- 9 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityUpdate()
Responds to updates to an entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity that was just saved.
See also
File
- core/
modules/ workspaces/ src/ EntityOperations.php, line 202
Class
- EntityOperations
- Defines a class for reacting to entity events.
Namespace
Drupal\workspacesCode
public function entityUpdate(EntityInterface $entity) {
// Only run if the entity type can belong to a workspace and we are in a
// non-default workspace.
if (!$this->workspaceManager
->shouldAlterOperations($entity
->getEntityType())) {
return;
}
// Only track new revisions.
/** @var \Drupal\Core\Entity\RevisionableInterface $entity */
if ($entity
->getLoadedRevisionId() != $entity
->getRevisionId()) {
$this->workspaceAssociation
->trackEntity($entity, $this->workspaceManager
->getActiveWorkspace());
}
}