You are here

function _hs_menu_children in Hierarchical Select 7.3

Same name and namespace in other branches
  1. 6.3 modules/hs_menu.module \_hs_menu_children()

Recursive helper function for hs_menu_hierarchical_select_children().

1 call to _hs_menu_children()
hs_menu_hierarchical_select_children in modules/hs_menu.module
Implements hook_hierarchical_select_children().

File

modules/hs_menu.module, line 261
Implementation of the Hierarchical Select API for the Menu module.

Code

function _hs_menu_children($tree, $menu_name, $plid = 0, $exclude = FALSE) {
  $children = array();
  foreach ($tree as $data) {
    if ($data['link']['plid'] == $plid && $data['link']['hidden'] >= 0) {
      if ($exclude && $data['link']['menu_name'] === $exclude[0] && $data['link']['mlid'] == $exclude[1]) {
        continue;
      }
      $title = truncate_utf8($data['link']['title'], 30, TRUE, FALSE);
      if ($data['link']['hidden']) {
        $title .= ' (' . t('disabled') . ')';
      }
      $children[$menu_name . ':' . $data['link']['mlid']] = $title;
      if ($data['below']) {
        $children += _hs_menu_children($data['below'], $menu_name, $plid, $exclude);
      }
    }
    elseif ($data['below']) {
      $children += _hs_menu_children($data['below'], $menu_name, $plid, $exclude);
    }
  }
  return $children;
}