You are here

public function EntityOperations::entityInsert in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/EntityOperations.php \Drupal\workbench_moderation\EntityOperations::entityInsert()

Hook bridge.

Parameters

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

See also

hook_entity_insert()

File

src/EntityOperations.php, line 196

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\workbench_moderation

Code

public function entityInsert(EntityInterface $entity) {
  if (!$this->moderationInfo
    ->isModeratableEntity($entity)) {
    return;
  }

  /* ContentEntityInterface $entity */

  // Update our own record keeping.
  $this->tracker
    ->setLatestRevision($entity
    ->getEntityTypeId(), $entity
    ->id(), $entity
    ->language()
    ->getId(), $entity
    ->getRevisionId());
}