function dna_visible_nodes

Same name and namespace in other branches
  1. 6.x-1.x devel_node_access.module \dna_visible_nodes()

Retreives the nodes visible in the current menu entry.

Parameters

integer $nid: (optional) A node ID to add to the list.

Return value

array An associative array of Node ID's that this function has been called with keyed by Node ID.

2 calls to dna_visible_nodes()
devel_node_access_block_view in ./devel_node_access.module
Implements hook_block_view().
devel_node_access_node_view in ./devel_node_access.module
Implements hook_node_view().

File

./devel_node_access.module, line 253

Code

function dna_visible_nodes($nid = NULL) {
  static $nids = array();
  if ($nid) {
    $nids[$nid] = $nid;
  }
  elseif (empty($nids)) {
    $menu_item = menu_get_item();
    $map = $menu_item['original_map'];
    if ($map[0] == 'node' && isset($map[1]) && is_numeric($map[1]) && !isset($map[2])) {
      // show DNA information on node/NID even if access is denied (IF the user has the 'view devel_node_access information' permission)!
      return array(
        $map[1],
      );
    }
  }
  return $nids;
}