function ConfigSubscriber::onConfigSave
Causes the container to be rebuilt on the next request if necessary.
Parameters
\Drupal\Core\Config\ConfigCrudEvent $event: The configuration event.
File
-
core/
modules/ locale/ src/ EventSubscriber/ ConfigSubscriber.php, line 25
Class
- ConfigSubscriber
- Rebuilds the container when locale config is changed.
Namespace
Drupal\locale\EventSubscriberCode
public function onConfigSave(ConfigCrudEvent $event) : void {
$saved_config = $event->getConfig();
if (!$saved_config->isNew() && $saved_config->getName() == 'locale.settings' && $event->isChanged('translate_english')) {
// Trigger a container rebuild on the next request by invalidating it.
$this->kernel
->invalidateContainer();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.