ConfigurableLanguage::postDelete

public static ConfigurableLanguage::postDelete(EntityStorageInterface $storage, array $entities)

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/modules/language/src/Entity/ConfigurableLanguage.php, line 163

Class

ConfigurableLanguage
Defines the ConfigurableLanguage entity.

Namespace

Drupal\language\Entity

Code

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);
  $language_manager = \Drupal::languageManager();
  $language_manager->reset();
  $entity = reset($entities);
  if ($language_manager instanceof ConfigurableLanguageManagerInterface && !$entity->isUninstalling() && !$entity->isSyncing()) {
    $language_manager->updateLockedLanguageWeights();
  }
  // If after deleting this language the site will become monolingual, we need
  // to rebuild language services.
  if (!\Drupal::languageManager()->isMultilingual()) {
    ConfigurableLanguageManager::rebuildServices();
  }
}
doc_Drupal
2016-10-29 08:55:07
Comments
Leave a Comment

Please login to continue.