You are here

function theme_better_messages_content in Better Messages 6

Same name and namespace in other branches
  1. 6.2 better_messages.module \theme_better_messages_content()
  2. 7.2 better_messages.module \theme_better_messages_content()
  3. 7 better_messages.module \theme_better_messages_content()
1 theme call to theme_better_messages_content()
theme_better_messages in ./better_messages.module

File

./better_messages.module, line 76

Code

function theme_better_messages_content($display = NULL) {
  $output = '';
  $first = TRUE;
  foreach (drupal_get_messages($display) as $type => $messages) {
    $class = $first ? 'first' : '';
    $first = FALSE;
    $output .= "<h2 class=\"messages-label {$type}\">" . t(drupal_ucfirst($type)) . "</h2>\n";
    $output .= "<div class=\"messages {$type}\">\n";
    if (count($messages) > 1) {
      $output .= " <ul>\n";
      foreach ($messages as $k => $message) {
        if ($k == 0) {
          $output .= "<li class='message-item first'>{$message}</li>";
        }
        else {
          if ($k == count($messages) - 1) {
            $output .= "<li class='message-item last'>{$message}</li>";
          }
          else {
            $output .= "<li class='message-item'>{$message}</li>";
          }
        }
      }
      $output .= " </ul>\n";
    }
    else {
      $output .= $messages[0];
    }
    $output .= "</div>\n";
  }
  return $output;
}