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 .= "
"; if (!empty($status_heading[$type])) { $output .= '

' . $status_heading[$type] . "

"; } if (count($messages) > 1) { $output .= "
    "; foreach ($messages as $message) { $output .= '
  • ' . $message . "
  • "; } $output .= "
"; } else { $output .= $messages[0]; } $output .= "
"; } return $output; }

Comments

Jeff Burnz’s picture

Assigned:Unassigned» Jeff Burnz

Yeah, it needs to be fixed, thanks for posting the issue, I have been meaning to fix this for ages.

Jeff Burnz’s picture

Status:Active» Fixed

This is what it should be like, with just one ID wrapper, not one for each message, since they already have wrappers - will commit shortly:

function adaptivetheme_status_messages($vars) {
  $display = $vars['display'];
  $output = '';

  $status_heading = array(
    'status' => t('Status message'),
    'error' => t('Error message'),
    'warning' => t('Warning message'),
  );

  $output .= "
"; foreach (drupal_get_messages($display) as $type => $messages) { $output .= "
"; if (!empty($status_heading[$type])) { $output .= '

' . $status_heading[$type] . "

"; } if (count($messages) > 1) { $output .= "
    "; foreach ($messages as $message) { $output .= '
  • ' . $message . "
  • "; } $output .= "
"; } else { $output .= $messages[0]; } $output .= "
"; } $output .= "
"; return $output; }
Jeff Burnz’s picture

Committed.

cspitzlay’s picture

Wow, that was quick. :)
Thanks.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.