You are here

function theme_better_messages in Better Messages 7

Same name and namespace in other branches
  1. 6.2 better_messages.module \theme_better_messages()
  2. 6 better_messages.module \theme_better_messages()
  3. 7.2 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 65

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['display']);
  if ($better_messages && $access && !empty($message)) {
    $disable_autoclose = better_messages_process_autoclose($message);
    better_messages_add_files($disable_autoclose);
    $message = theme('better_messages_content', array(
      'messages_drupal' => $message,
    ));

    // We save the initial output to SESSION so we can put it in <noscript> on page_preprocess
    $_SESSION['original_messages'] = $message;
    $message_skin = theme('better_messages', array(
      'content' => $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', array(
      'messages_drupal' => $message,
    ));
  }
  return $output;
}