You are here

protected function ContentEntityStorageBase::invokeFieldPostSave in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::invokeFieldPostSave()
  2. 10 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::invokeFieldPostSave()

Invokes the post save method on the Field objects within an entity.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity object.

bool $update: Specifies whether the entity is being updated or created.

1 call to ContentEntityStorageBase::invokeFieldPostSave()
ContentEntityStorageBase::invokeHook in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Invokes a hook on behalf of the entity.

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 866

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

protected function invokeFieldPostSave(ContentEntityInterface $entity, $update) {

  // For each entity translation this returns an array of resave flags keyed
  // by field name, thus we merge them to obtain a list of fields to resave.
  $resave = [];
  foreach ($this
    ->invokeFieldMethod('postSave', $entity, $update) as $translation_results) {
    $resave += array_filter($translation_results);
  }
  if ($resave) {
    $this
      ->doSaveFieldItems($entity, array_keys($resave));
  }
}