You are here

function theme_better_messages_content in Better Messages 7

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

Code

function theme_better_messages_content($variables) {
  $messages_drupal = $variables['messages_drupal'];
  $output = '';
  $first = TRUE;
  foreach ($messages_drupal 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>";
        }
        elseif ($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;
}