You are here

function theme_better_messages in Better Messages 6

Same name and namespace in other branches
  1. 6.2 better_messages.module \theme_better_messages()
  2. 7.2 better_messages.module \theme_better_messages()
  3. 7 better_messages.module \theme_better_messages()
1 string reference to 'theme_better_messages'
better_messages_theme_registry_alter in ./better_messages.module

File

./better_messages.module, line 56

Code

function theme_better_messages($display = NULL) {
  $output = '';
  $better_messages = better_messages_process_visibility();
  $access = user_access('access better messages');
  $message = drupal_get_messages($display, false);
  if ($better_messages && $access && !empty($message)) {
    $disable_autoclose = array_key_exists('error', $message);
    better_messages_add_files($disable_autoclose);
    $message = theme('better_messages_content', $display);

    // We save the intial output to SESSION so we can put it in <noscript> on page_preprocess
    $_SESSION['original_messages'] = $message;
    $message_skin = theme('better_messages', $message);

    // We add a special ID so that JavaScript knows what to handle. Changing the ID will break JavaScript handling code.
    $output = "<div id=\"better-messages-wrapper\" style=\"display:none;overflow:visible;position:absolute;z-index:9999;\">\n" . $message_skin . "\n</div>\n";
  }
  else {
    $output = theme('better_messages_content', $display);
  }
  return $output;
}