function ConfigurableLanguage::postDelete
Same name in other branches
- 9 core/modules/language/src/Entity/ConfigurableLanguage.php \Drupal\language\Entity\ConfigurableLanguage::postDelete()
- 8.9.x core/modules/language/src/Entity/ConfigurableLanguage.php \Drupal\language\Entity\ConfigurableLanguage::postDelete()
- 10 core/modules/language/src/Entity/ConfigurableLanguage.php \Drupal\language\Entity\ConfigurableLanguage::postDelete()
Overrides EntityBase::postDelete
File
-
core/
modules/ language/ src/ Entity/ ConfigurableLanguage.php, line 187
Class
- ConfigurableLanguage
- Defines the ConfigurableLanguage entity.
Namespace
Drupal\language\EntityCode
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();
}
// Remove language from language prefix and domain list.
$config = \Drupal::configFactory()->getEditable('language.negotiation');
$config->clear('url.prefixes.' . $entity->id());
$config->clear('url.domains.' . $entity->id());
$config->save(TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.