You are here

function locale_js_settings_alter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/locale/locale.module \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 612
Enables the translation of the user interface to languages other than English.

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