You are here

function _taxonomy_menu_build_menu_tree in Taxonomy menu 6.3

Helper function for taxonomy_menu_build_menu_tree

1 call to _taxonomy_menu_build_menu_tree()
taxonomy_menu_build_menu_tree in ./taxonomy_menu.admin.inc
This function orders the items array correctly.

File

./taxonomy_menu.admin.inc, line 964
admin section for taxonomy menu

Code

function _taxonomy_menu_build_menu_tree(&$items, $key) {

  // Return the children for the key
  $output = array();
  foreach ($items as $item_key => $item) {
    if ($item->parent == $key) {
      $output[$item_key] = $item;
      unset($items[$item_key]);
    }
  }
  if (!$output) {
    return array();
  }

  // Sort by the weight

  //$output = new objSorter($output, 'weight');
  usort($output, '_taxonomy_menu_sort_tree');

  // Re add the indexes
  foreach ($ouput as $index => $value) {
    unset($output[$index]);
    $output[$value->tsid . ':' . $value->tid];
  }
  return $output;
}