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');
  }
}
doc_Drupal
2016-10-29 09:24:16
Comments
Leave a Comment

Please login to continue.