public static function ConfigurableLanguage::postDelete in Drupal 8
Same name and namespace in other branches
- 9 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 EntityBase::postDelete
File
- core/
modules/ language/ src/ Entity/ ConfigurableLanguage.php, line 185
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);
}