function nicemessages_set_messages in Nice messages 7.2
Same name and namespace in other branches
- 7 nicemessages.module \nicemessages_set_messages()
Save messages to js settings.
1 call to nicemessages_set_messages()
- nicemessages_preprocess_page in ./
nicemessages.module - Implements hook_preprocess_page().
File
- ./
nicemessages.module, line 153 - Nicemessages module
Code
function nicemessages_set_messages() {
$items = array();
foreach (drupal_get_messages() as $type => $messages) {
foreach ($messages as $key => $message) {
$item = array(
'type' => $type,
'content' => $message,
'life' => variable_get('nicemessages_' . $type . '_life', '6') * 1000,
'glue' => variable_get('nicemessages_' . $type . '_glue', 'after'),
'speed' => variable_get('nicemessages_' . $type . '_speed', 'slow'),
);
$items[] = $item;
}
}
$settings = array(
'position' => variable_get('nicemessages_position', 'bottom-left'),
'items' => $items,
);
drupal_alter('nicemessages', $settings);
drupal_add_js(array(
'nicemessages' => $settings,
), 'setting');
}