BaseFieldOverride::postDelete

public static BaseFieldOverride::postDelete(EntityStorageInterface $storage, array $field_overrides)

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 Entity::postDelete

File

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

Class

BaseFieldOverride
Defines the base field override entity.

Namespace

Drupal\Core\Field\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $field_overrides) {
  $entity_manager = \Drupal::entityManager();
  // Clear the cache upfront, to refresh the results of getBundles().
  $entity_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_manager->getStorage($field_override->getTargetEntityTypeId())->onFieldDefinitionUpdate($field_override->getBaseFieldDefinition(), $field_override);
  }
}
doc_Drupal
2016-10-29 08:45:53
Comments
Leave a Comment

Please login to continue.