public ConfigurableLanguage::postSave(EntityStorageInterface $storage, $update = TRUE)
Acts on a saved entity before the insert or update hook is invoked.
Used after the entity is saved, but before invoking the insert or update hook. Note that in case of translatable content entities this callback is only fired on their current translation. It is up to the developer to iterate over all translations if needed.
Parameters
\Drupal\Core\Entity\EntityStorageInterface $storage: The entity storage object.
bool $update: TRUE if the entity has been updated, or FALSE if it has been inserted.
Overrides Entity::postSave
File
- core/modules/language/src/Entity/ConfigurableLanguage.php, line 120
Class
- ConfigurableLanguage
- Defines the ConfigurableLanguage entity.
Namespace
Drupal\language\Entity
Code
public function postSave(EntityStorageInterface $storage, $update = TRUE) { parent::postSave($storage, $update); $language_manager = \Drupal::languageManager(); $language_manager->reset(); if (!$this->isLocked() && $language_manager instanceof ConfigurableLanguageManagerInterface && !$this->isSyncing()) { $language_manager->updateLockedLanguageWeights(); } // Update URL Prefixes for all languages after the // LanguageManagerInterface::getLanguages() cache is flushed. language_negotiation_url_prefixes_update(); // If after adding this language the site will become multilingual, we need // to rebuild language services. if (!$this->preSaveMultilingual && !$update && $language_manager instanceof ConfigurableLanguageManagerInterface) { $language_manager::rebuildServices(); } if (!$update) { // Install any available language configuration overrides for the language. \Drupal::service('language.config_factory_override')->installLanguageOverrides($this->id()); } }
Please login to continue.