W3cubDocs

/Drupal 8

function locale_js_settings_alter

locale_js_settings_alter(&$settings, AttachedAssetsInterface $assets)

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!locale!locale.module/function/locale_js_settings_alter/8.1.x