function absolute_messages_init in Absolute Messages 6
Implementation of hook_init().
File
- ./
absolute_messages.module, line 39 - Module displaying system messages in colored horizontal bars on top of the page, similar to Stack Overflow / Stack Exchange network notifications.
Code
function absolute_messages_init() {
// Add module JS and CSS.
drupal_add_css(drupal_get_path('module', 'absolute_messages') . '/absolute_messages.css');
drupal_add_js(drupal_get_path('module', 'absolute_messages') . '/absolute_messages.js');
if (variable_get('absolute_messages_fixed', FALSE)) {
drupal_add_css(drupal_get_path('module', 'absolute_messages') . '/absolute_messages_fixed.css');
}
// Module configuration for JS.
$settings = array(
'dismiss' => array(),
'dismiss_time' => array(),
'dismiss_all_count' => variable_get('absolute_messages_dismiss_all_count', 2),
);
foreach (_absolute_messages_message_types() as $message_type) {
$settings['dismiss'][$message_type] = variable_get('absolute_messages_dismiss_' . $message_type, FALSE);
$settings['dismiss_time'][$message_type] = variable_get('absolute_messages_dismiss_time_' . $message_type, '');
}
// Maximum number of lines to display.
if ($max_lines = variable_get('absolute_messages_display_lines', '')) {
$settings['max_lines'] = $max_lines;
}
// Pass configuration to JS.
drupal_add_js(array(
'absoluteMessages' => $settings,
), 'setting');
}