function locale_js_settings_alter

Implements hook_js_settings_alter().

Generates the values for the altered core/jquery.ui.datepicker library.

File

core/modules/locale/locale.module, line 616

Code

function locale_js_settings_alter(&$settings, AttachedAssetsInterface $assets) {
    if (isset($settings['jquery']['ui']['datepicker'])) {
        $language_interface = \Drupal::languageManager()->getCurrentLanguage();
        $settings['jquery']['ui']['datepicker']['isRTL'] = $language_interface->getDirection() == LanguageInterface::DIRECTION_RTL;
        $settings['jquery']['ui']['datepicker']['firstDay'] = \Drupal::config('system.date')->get('first_day');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.