_menu_parents_recurse

Versions
6 – 7
_menu_parents_recurse($tree, $menu_name, $indent, &$options, $exclude, $depth_limit)

Recursive helper function for menu_parent_options().

▾ 2 functions call _menu_parents_recurse()

menu_parent_options in modules/menu/menu.module
Return a list of menu items that are valid possible parents for the given menu item.
_menu_parents_recurse in modules/menu/menu.module
Recursive helper function for menu_parent_options().

Code

modules/menu/menu.module, line 235

<?php
function _menu_parents_recurse($tree, $menu_name, $indent, &$options, $exclude, $depth_limit) {
  foreach ($tree as $data) {
    if ($data['link']['depth'] > $depth_limit) {
      // Don't iterate through any links on this level.
      break;
    }
    if ($data['link']['mlid'] != $exclude && $data['link']['hidden'] >= 0) {
      $title = $indent .' '. truncate_utf8($data['link']['title'], 30, TRUE, FALSE);
      if ($data['link']['hidden']) {
        $title .= ' ('. t('disabled') .')';
      }
      $options[$menu_name .':'. $data['link']['mlid']] = $title;
      if ($data['below']) {
        _menu_parents_recurse($data['below'], $menu_name, $indent .'--', $options, $exclude, $depth_limit);
      }
    }
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.