function chosen_lib_library_info_alter in Chosen 8.2
Same name and namespace in other branches
- 3.0.x modules/chosen_lib/chosen_lib.module \chosen_lib_library_info_alter()
Implements hook_library_info_alter().
File
- modules/
chosen_lib/ chosen_lib.module, line 13 - General functions and hook implementations.
Code
function chosen_lib_library_info_alter(array &$libraries, $module) {
if ('chosen_lib' == $module) {
if (isset($libraries['chosen'])) {
// Set chosen library path.
$chosen_js_path = _chosen_lib_get_chosen_path();
$minified = file_exists($chosen_js_path . '/chosen.jquery.min.js');
$chosen_js_path = '/' . $chosen_js_path;
$chosen_js = $minified ? $chosen_js_path . '/chosen.jquery.min.js' : $chosen_js_path . '/chosen.jquery.js';
$libraries['chosen']['js'][$chosen_js] = [
'minified' => $minified,
];
$chosen_css = $chosen_js_path . '/chosen.css';
$libraries['chosen.css']['css']['component'][$chosen_css] = [];
}
}
}