You are here

public static function ConfigurableLanguage::postDelete in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/Entity/ConfigurableLanguage.php \Drupal\language\Entity\ConfigurableLanguage::postDelete()

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 168
Contains \Drupal\language\Entity\ConfigurableLanguage.

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