Same name and namespace in other branches
  1. 4.7.x includes/theme.inc \theme_status_messages()
  2. 5.x includes/theme.inc \theme_status_messages()
  3. 6.x includes/theme.inc \theme_status_messages()
  4. 7.x includes/theme.inc \theme_status_messages()

Returns themed set of status and/or error messages. The messages are grouped by type.

Return value

A string containing the messages.

Related topics

2 calls to theme_status_messages()
chameleon_page in themes/chameleon/chameleon.theme
theme_page in includes/theme.inc
Return an entire Drupal page displaying the supplied content.

File

includes/theme.inc, line 421
The theme system, which controls the output of Drupal.

Code

function theme_status_messages() {
  if ($data = drupal_get_messages()) {
    $output = '';
    foreach ($data as $type => $messages) {
      $output .= "<div class=\"messages {$type}\">\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;
  }
}