function better_messages_add_files in Better Messages 7
Same name and namespace in other branches
- 6.2 better_messages.module \better_messages_add_files()
- 6 better_messages.module \better_messages_add_files()
Helper function to add required JS and CSS only when required
1 call to better_messages_add_files()
File
- ./
better_messages.module, line 212
Code
function better_messages_add_files($disable_autoclose) {
$settings = better_messages_get_settings();
drupal_add_js(drupal_get_path('module', 'better_messages') . '/better_messages.js');
// Remove extra info from JS
if (!module_exists('jquery_ui')) {
unset($settings['jquery_ui']);
}
else {
foreach ($settings['jquery_ui'] as $jquery_ui_setting => $value) {
if ($value == 1) {
jquery_ui_add(array(
'ui.' . $jquery_ui_setting,
));
}
}
}
unset($settings['extra']);
if ($disable_autoclose) {
$settings['autoclose'] = 0;
}
drupal_add_js(array(
'betterMessages' => $settings,
), 'setting');
}