You are here

function theme_better_messages_content in Better Messages 7.2

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 better_messages.module \theme_better_messages_content()

This function is exactly the same as theme_status_messages. We had to override it to make it called from theme('status_messages') call theme_better_messages() and then call theme_status_messages().

Parameters

$variables: An associative array containing:

  • display: (optional) Set to 'status' or 'error' to display only messages of that type.
1 theme call to theme_better_messages_content()
theme_better_messages in ./better_messages.module
Theme function that switches default Drupal messages with Better Messages.

File

./better_messages.module, line 229

Code

function theme_better_messages_content($variables) {
  $display = $variables['display'];
  $output = '';
  $status_heading = array(
    'status' => t('Status message'),
    'error' => t('Error message'),
    'warning' => t('Warning message'),
  );
  foreach (drupal_get_messages($display) as $type => $messages) {
    $output .= "<div class=\"messages {$type}\">\n";
    if (!empty($status_heading[$type])) {
      $output .= '<h2 class="element-invisible">' . $status_heading[$type] . "</h2>\n";
    }
    if (count($messages) > 1) {
      $output .= " <ul>\n";
      foreach ($messages as $message) {
        $output .= '  <li>' . $message . "</li>\n";
      }
      $output .= " </ul>\n";
    }
    else {
      $output .= $messages[0];
    }
    $output .= "</div>\n";
  }
  return $output;
}