function EntityOperations::entityInsert

Same name in this branch
  1. 9 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityInsert()
Same name in other branches
  1. 8.9.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityInsert()
  2. 8.9.x core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityInsert()
  3. 10 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityInsert()
  4. 10 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityInsert()
  5. 11.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityInsert()
  6. 11.x core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityInsert()

Parameters

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

See also

hook_entity_insert()

File

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

Class

EntityOperations
Defines a class for reacting to entity events.

Namespace

Drupal\content_moderation

Code

public function entityInsert(EntityInterface $entity) {
    if ($this->moderationInfo
        ->isModeratedEntity($entity)) {
        $this->updateOrCreateFromEntity($entity);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.