You are here

public function EntityOperations::entityUpdate in Drupal 9

Same name in this branch
  1. 9 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityUpdate()
  2. 9 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityUpdate()
Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityUpdate()

Parameters

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

See also

hook_entity_update()

File

core/modules/content_moderation/src/EntityOperations.php, line 147

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\content_moderation

Code

public function entityUpdate(EntityInterface $entity) {
  if ($this->moderationInfo
    ->isModeratedEntity($entity)) {
    $this
      ->updateOrCreateFromEntity($entity);
  }
  elseif ($entity instanceof Workflow && $entity
    ->getTypePlugin()
    ->getPluginId() == 'content_moderation') {
    $this->routerBuilder
      ->setRebuildNeeded();
  }
}