1 locale.module locale_library_info_alter(&$libraries, $module)

Implement hook_library_info_alter().

Provides the language support for the jQuery UI Date Picker.

File

core/modules/locale/locale.module, line 812
Add language handling functionality and enables the translation of the user interface to languages other than English.

Code

function locale_library_info_alter(&$libraries, $module) {
  if ($module == 'system' && isset($libraries['ui.datepicker'])) {
    global $language;
    // locale.datepicker.js should be added in the JS_LIBRARY group, so that
    // this attach behavior will execute early. JS_LIBRARY is the default for
    // hook_library_info_alter(), thus does not have to be specified explicitly.
    $datepicker = backdrop_get_path('module', 'locale') . '/js/locale.datepicker.js';
    $libraries['ui.datepicker']['js'][$datepicker] = array();
    $libraries['ui.datepicker']['js'][] = array(
      'data' => array(
        'jquery' => array(
          'ui' => array(
            'datepicker' => array(
              'isRTL' => $language->direction == LANGUAGE_RTL,
              'firstDay' => config_get('system.date', 'first_day'),
            ),
          ),
        ),
      ),
      'type' => 'setting',
    );
  }
}