You are here

public function EntityOperations::entityUpdate in Workspace 8.2

Responds to updates to an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity that was just saved.

See also

hook_entity_update()

File

src/EntityOperations.php, line 197

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\workspace

Code

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
      ->trackEntity($entity);
  }
}