function locale_library_alter
7.x locale.module | locale_library_alter(&$libraries, $module) |
Implement hook_library_alter().
Provides the language support for the jQuery UI Date Picker.
File
- drupal-7.x/
modules/ locale/ locale.module, line 988 - Add language handling functionality and enables the translation of the user interface to languages other than English.
Code
function locale_library_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 = drupal_get_path('module', 'locale') . '/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' => variable_get('date_first_day', 0),
),
),
),
),
'type' => 'setting',
);
}
}