function locale_library_alter
Implement hook_library_alter().
Provides the language support for the jQuery UI Date Picker.
File
-
modules/
locale/ locale.module, line 991
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',
);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.