function FieldConfigBase::postDelete

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Field/FieldConfigBase.php \Drupal\Core\Field\FieldConfigBase::postDelete()

Overrides EntityBase::postDelete

1 call to FieldConfigBase::postDelete()
FieldConfig::postDelete in core/modules/field/src/Entity/FieldConfig.php
Acts on deleted entities before the delete hook is invoked.
2 methods override FieldConfigBase::postDelete()
BaseFieldOverride::postDelete in core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php
Acts on deleted entities before the delete hook is invoked.
FieldConfig::postDelete in core/modules/field/src/Entity/FieldConfig.php
Acts on deleted entities before the delete hook is invoked.

File

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

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);
        }
    }
}

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