1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function lumen_node_bits($key = NULL, $bits = array()) {
  static $node_bits = array();
  $output = array();
    
  if (is_numeric($key)) {
    if (!empty($bits)) {
      $node_bits[$key] = isset($node_bits[$key]) ? array_merge($node_bits[$key], $bits) : $bits;
    }
    else {
      $output = isset($node_bits[$key]) ? $node_bits[$key] : FALSE;
    }
  }
  elseif (array_key_exists($key, $node_bits)) {
    foreach ($node_bits as $nid => $bits) {
      $output = array_merge($output, $bits[$key]);
    }
  }
  else {
    $output = $node_bits;
  }
  
  return $output;
}