menu_tree_check_access
function menu_tree_check_access
menu_tree_check_access(&$tree, $node_links = array())
Checks access and performs dynamic operations for each link in the tree.
Parameters
$tree: The menu tree you wish to operate on.
$node_links: A collection of node link references generated from $tree by menu_tree_collect_node_links().
Related topics
File
- includes/menu.inc, line 1497
- API for the Drupal menu system.
Code
function menu_tree_check_access(&$tree, $node_links = array()) { if ($node_links && (user_access('access content') || user_access('bypass node access'))) { $nids = array_keys($node_links); $select = db_select('node', 'n'); $select->addField('n', 'nid'); $select->condition('n.status', 1); $select->condition('n.nid', $nids, 'IN'); $select->addTag('node_access'); $nids = $select->execute()->fetchCol(); foreach ($nids as $nid) { foreach ($node_links[$nid] as $mlid => $link) { $node_links[$nid][$mlid]['access'] = TRUE; } } } _menu_tree_check_access($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