Acts on deleted entities before the delete hook is invoked.

Used after the entities are deleted but before invoking the delete hook.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.

\Drupal\Core\Entity\EntityInterface[] $entities: An array of entities.

Overrides EntityBase::postDelete

File

core/lib/Drupal/Core/Field/FieldConfigBase.php, line 294

Class

FieldConfigBase
Base class for configurable field definitions.

Namespace

Drupal\Core\Field

Code

public static function postDelete(EntityStorageInterface $storage, array $fields) {

  // Clear the cache upfront, to refresh the results of getBundles().
  \Drupal::service('entity_field.manager')
    ->clearCachedFieldDefinitions();

  // Notify the entity storage.
  foreach ($fields as $field) {
    if (!$field->deleted) {
      \Drupal::service('field_definition.listener')
        ->onFieldDefinitionDelete($field);
    }
  }
}