public function LanguageConfigFactoryOverride::onConfigRename in Drupal 8
Same name and namespace in other branches
- 9 core/modules/language/src/Config/LanguageConfigFactoryOverride.php \Drupal\language\Config\LanguageConfigFactoryOverride::onConfigRename()
- 10 core/modules/language/src/Config/LanguageConfigFactoryOverride.php \Drupal\language\Config\LanguageConfigFactoryOverride::onConfigRename()
Actions to be performed to configuration override on configuration rename.
Parameters
\Drupal\Core\Config\ConfigRenameEvent $event: The config rename event.
Overrides ConfigFactoryOverrideBase::onConfigRename
File
- core/
modules/ language/ src/ Config/ LanguageConfigFactoryOverride.php, line 197
Class
- LanguageConfigFactoryOverride
- Provides language overrides for the configuration factory.
Namespace
Drupal\language\ConfigCode
public function onConfigRename(ConfigRenameEvent $event) {
$config = $event
->getConfig();
$name = $config
->getName();
$old_name = $event
->getOldName();
foreach (\Drupal::languageManager()
->getLanguages() as $language) {
$config_translation = $this
->getOverride($language
->getId(), $old_name);
if (!$config_translation
->isNew()) {
$saved_config = $config_translation
->get();
$storage = $this
->getStorage($language
->getId());
$storage
->write($name, $saved_config);
$config_translation
->delete();
}
}
}