Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TimeZoneResolver.php

function 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\system

Code

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();
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal