4.6.x theme.inc theme_status_messages()
4.7.x theme.inc theme_status_messages()
5.x theme.inc theme_status_messages($display = NULL)
6.x theme.inc theme_status_messages($display = NULL)
7.x theme.inc theme_status_messages($variables)

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


$display: (optional) Set to 'status' or 'error' to display only messages of that type.

Return value

A string containing the messages.

Related topics

7 theme calls to theme_status_messages()
chameleon_page in themes/chameleon/chameleon.theme
poll_choice_js in modules/poll/poll.module
Menu callback for AHAH additions.
template_preprocess_maintenance_page in includes/theme.maintenance.inc
The variables generated here is a mirror of template_preprocess_page(). This preprocessor will run it's course when theme_maintenance_page() is invoked. It is also used in theme_install_page() and theme_update_page() to keep all the variables…
template_preprocess_page in includes/theme.inc
Process variables for page.tpl.php
theme_install_page in includes/theme.maintenance.inc
Generate a themed installation page.

... See full list


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


function theme_status_messages($display = NULL) {
  $output = '';
  foreach (drupal_get_messages($display) 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;