public function TimeZoneResolver::onConfigSave in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/src/TimeZoneResolver.php \Drupal\system\TimeZoneResolver::onConfigSave()
Updates the default time zone when time zone config changes.
Parameters
\Drupal\Core\Config\ConfigCrudEvent $event: The config crud event.
File
- core/
modules/ system/ src/ TimeZoneResolver.php, line 64
Class
- TimeZoneResolver
- Event handler that resolves time zone based on site and user configuration.
Namespace
Drupal\systemCode
public function onConfigSave(ConfigCrudEvent $event) {
$saved_config = $event
->getConfig();
if ($saved_config
->getName() === 'system.date' && ($event
->isChanged('timezone.default') || $event
->isChanged('timezone.user.configurable'))) {
$this
->setDefaultTimeZone();
}
}