Fix for Fix for expanded menu overide for set MID

  1. /**
  2. * Implementation of theme_menu_item().
  3. * Add active class and custom id to current menu item links.
  4. */
  5. function zen_menu_item($mid, $children = '', $leaf = TRUE) {
  6.   $item = menu_get_item($mid); // get current menu item
  7.   // decide whether to add the active class to this menu item
  8.   if ((drupal_get_normal_path($item['path']) == $_GET['q']) // if menu item path...
  9.   || (drupal_is_front_page() && $item['path'] == '<front>')) { // or front page...
  10.     $active_class = ' active'; // set active class
  11.   } else { // otherwise...
  12.     $active_class = ''; // do nothing
  13.   }
  14. if (!$children || (!drupal_is_front_page() && $mid == 109) )
  15. {
  16.   $is_expanded = false;
  17. }
  18. else
  19. {
  20.   $is_expanded = true;
  21. }
  22.   $attribs = isset($item['description']) ?
  23. array('title' => $item['description']) : array();
  24.   $replace = array(' ', '&');
  25.   $attribs['id'] = 'menu-'. str_replace($replace, '-', strtolower($item['title']));
  26.   return
  27. '
  28. <li class="'. ($leaf ? 'leaf' : ($is_expanded ? 'expanded' : 'collapsed')) .
  29. $active_class .'" id="'. $attribs['id'] . '">' .
  30. menu_item_link($mid) . $children ."</li>
  31. \n";
  32. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.