Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following function from at_core/inc/theme.inc creates more than one div with id="messages" if there are messages of more than one type to be displayed, leading to invalid HTML:
function adaptivetheme_status_messages($vars) {
$display = $vars['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 id=\"messages\"><div class=\"messages $type\">";
if (!empty($status_heading[$type])) {
$output .= '<h2 class="element-invisible">' . $status_heading[$type] . "</h2>";
}
if (count($messages) > 1) {
$output .= " <ul>";
foreach ($messages as $message) {
$output .= ' <li>' . $message . "</li>";
}
$output .= " </ul>";
}
else {
$output .= $messages[0];
}
$output .= "</div></div>";
}
return $output;
}
Comments
Comment #1
Jeff Burnz CreditAttribution: Jeff Burnz commentedYeah, it needs to be fixed, thanks for posting the issue, I have been meaning to fix this for ages.
Comment #2
Jeff Burnz CreditAttribution: Jeff Burnz commentedThis is what it should be like, with just one ID wrapper, not one for each message, since they already have wrappers - will commit shortly:
Comment #3
Jeff Burnz CreditAttribution: Jeff Burnz commentedCommitted.
Comment #4
cspitzlayWow, that was quick. :)
Thanks.