Skip to content

Instantly share code, notes, and snippets.

@bratsun
Created October 19, 2013 00:38
Show Gist options
  • Save bratsun/7050319 to your computer and use it in GitHub Desktop.
Save bratsun/7050319 to your computer and use it in GitHub Desktop.
Messages hook - one message is also a list (ul)
function theme_status_messages($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";
}
$output .= " <ul>\n";
foreach ($messages as $message) {
$output .= ' <li>' . $message . "</li>\n";
}
$output .= " </ul>\n";
$output .= "</div>\n";
}
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment