_menu_tree_check_access
function _menu_tree_check_access
_menu_tree_check_access(&$tree)
Sorts the menu tree and recursively checks access for each item.
Related topics
File
- includes/menu.inc, line 1518
- API for the Drupal menu system.
Code
function _menu_tree_check_access(&$tree) { $new_tree = array(); foreach ($tree as $key => $v) { $item = &$tree[$key]['link']; _menu_link_translate($item); if ($item['access'] || ($item['in_active_trail'] && strpos($item['href'], '%') !== FALSE)) { if ($tree[$key]['below']) { _menu_tree_check_access($tree[$key]['below']); } // The weights are made a uniform 5 digits by adding 50000 as an offset. // After _menu_link_translate(), $item['title'] has the localized link title. // Adding the mlid to the end of the index insures that it is unique. $new_tree[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $tree[$key]; } } // Sort siblings in the tree based on the weights and localized titles. ksort($new_tree); $tree = $new_tree; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!menu.inc/function/_menu_tree_check_access/7.x