function BaseFieldOverride::postDelete

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php \Drupal\Core\Field\Entity\BaseFieldOverride::postDelete()
  2. 10 core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php \Drupal\Core\Field\Entity\BaseFieldOverride::postDelete()
  3. 11.x core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php \Drupal\Core\Field\Entity\BaseFieldOverride::postDelete()

Overrides EntityBase::postDelete

File

core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php, line 211

Class

BaseFieldOverride
Defines the base field override entity.

Namespace

Drupal\Core\Field\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $field_overrides) {
    $entity_type_manager = \Drupal::entityTypeManager();
    // Clear the cache upfront, to refresh the results of getBundles().
    \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
    
    /** @var \Drupal\Core\Field\Entity\BaseFieldOverride $field_override */
    foreach ($field_overrides as $field_override) {
        // Inform the system that the field definition is being updated back to
        // its non-overridden state.
        // @todo This assumes that there isn't a non-config-based override that
        //   we're returning to, but that might not be the case:
        //   https://www.drupal.org/node/2321071.
        $entity_type_manager->getStorage($field_override->getTargetEntityTypeId())
            ->onFieldDefinitionUpdate($field_override->getBaseFieldDefinition(), $field_override);
    }
}

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