You are here

function _menu_parents_recurse in Drupal 7

Same name and namespace in other branches
  1. 6 modules/menu/menu.module \_menu_parents_recurse()

Recursive helper function for menu_parent_options().

1 call to _menu_parents_recurse()
_menu_get_options in modules/menu/menu.module
Helper function to get the items of the given menu.

File

modules/menu/menu.module, line 431
Allows administrators to customize the site's navigation menus.

Code

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);
      menu_add_link_labels($title, $data['link']);
      $options[$menu_name . ':' . $data['link']['mlid']] = $title;
      if ($data['below']) {
        _menu_parents_recurse($data['below'], $menu_name, $indent . '--', $options, $exclude, $depth_limit);
      }
    }
  }
}