Commit 18f95033 authored by Nicolas Borda's avatar Nicolas Borda
Browse files

Issue #1153940 by Callie | jaclayton: Fixed Menu between brackets not working as in Drupal 6.

parent 192210ac
Loading
Loading
Loading
Loading
+77 −0
Changes for template.php: 77 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

function elements_theme_links__system_main_menu($variables){
  $links = $variables['links'];
  $attributes = $variables['attributes'];
  $heading = $variables['heading'];
  global $language_url;
  $output = '';

  if (count($links) > 0) {
    $output = '';

    // Treat the heading first if it is present to prepend it to the
    // list of links.
    if (!empty($heading)) {
      if (is_string($heading)) {
        // Prepare the array that will be used when the passed heading
        // is a string.
        $heading = array(
          'text' => $heading,
          // Set the default level of the heading.
          'level' => 'h2',
        );
      }
      $output .= '<' . $heading['level'];
      if (!empty($heading['class'])) {
        $output .= drupal_attributes(array('class' => $heading['class']));
      }
      $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
    }

    $output .= '<div id="pages">';

    $num_links = count($links);
    $i = 1;

    foreach ($links as $key => $link) {
      $class = array($key);

      // Add first, last and active classes to the list of links to help out themers.
      if ($i == 1) {
        $class[] = 'first';
      }
      if ($i == $num_links) {
        $class[] = 'last';
      }
      if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))
          && (empty($link['language']) || $link['language']->language == $language_url->language)) {
        $class[] = 'active';
      }
      $output .= '<span class="menu-items"><h3>';

      if (isset($link['href'])) {
        // Pass in $link as $options, they share the same keys.
        $output .= l($link['title'], $link['href'], $link);
      }
      elseif (!empty($link['title'])) {
        // Some links are actually not links, but we wrap these in <span> for adding title and class attributes.
        if (empty($link['html'])) {
          $link['title'] = check_plain($link['title']);
        }
        $span_attributes = '';
        if (isset($link['attributes'])) {
          $span_attributes = drupal_attributes($link['attributes']);
        }
        $output .= '<h3' . $span_attributes . '>' . $link['title'] . '</h3><span>' . $link['attributes']['title'] . '</span';
      }

      $i++;
      $output .= "</h3>" . $link['attributes']['title'] . "</span>\n";
    }

    $output .= '</div>';
  }

  return $output;
}
?>
 No newline at end of file
+0 −4
Changes for templates/page.tpl.php: 0 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -7,9 +7,7 @@
	        <div id="logo"><a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>" rel="home"><img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" id="logo-image" /></a></div>
	      <?php endif; ?> 
	
		  <div id="pages">
		    <?php if ($main_menu): ?>
		      <div id="navigation">
		        <?php print theme('links__system_main_menu', array(
		          'links' => $main_menu,
		          'attributes' => array(
@@ -22,9 +20,7 @@
		          'class' => array('element-invisible'),
		        ),
		        )); ?>
		      </div>
		    <?php endif; ?>
		  </div>
	
		  <?php if ($site_name): ?>
			<h1 id="site-name"><a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>" rel="home">