You are here

function theme_status_messages in Drupal 4

Same name and namespace in other branches
  1. 5 includes/theme.inc \theme_status_messages()
  2. 6 includes/theme.inc \theme_status_messages()
  3. 7 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

5 theme calls to theme_status_messages()
chameleon_page in themes/chameleon/chameleon.theme
phptemplate_page in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_page function to be passed into a pluggable template engine.
theme_maintenance_page in includes/theme.inc
theme_page in includes/theme.inc
Return an entire Drupal page displaying the supplied content.
upload_js in modules/upload.module
Menu-callback for JavaScript-based uploads.

File

includes/theme.inc, line 462
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;
  }
}