function FieldConfigBase::postSave

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Field/FieldConfigBase.php \Drupal\Core\Field\FieldConfigBase::postSave()
  2. 8.9.x core/lib/Drupal/Core/Field/FieldConfigBase.php \Drupal\Core\Field\FieldConfigBase::postSave()
  3. 11.x core/lib/Drupal/Core/Field/FieldConfigBase.php \Drupal\Core\Field\FieldConfigBase::postSave()

Overrides EntityBase::postSave

File

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

Class

FieldConfigBase
Base class for configurable field definitions.

Namespace

Drupal\Core\Field

Code

public function postSave(EntityStorageInterface $storage, $update = TRUE) {
  // Clear the cache.
  \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
  // Invalidate the render cache for all affected entities.
  $entity_type = $this->getFieldStorageDefinition()
    ->getTargetEntityTypeId();
  if ($this->entityTypeManager()
    ->hasHandler($entity_type, 'view_builder')) {
    $this->entityTypeManager()
      ->getViewBuilder($entity_type)
      ->resetCache();
  }
}

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