You are here

function coffee_traverse_below in Coffee 7.2

Function coffee_traverse_below().

Helper function to traverse down through a menu structure.

1 call to coffee_traverse_below()
coffee_get_menu_response in ./coffee.module
Function coffee_get_menu_response().

File

./coffee.module, line 87
Coffee primary module file

Code

function coffee_traverse_below($link, &$output, $command = NULL) {
  $l = isset($link['link']) ? $link['link'] : array();

  // Only add if user has access.
  if (isset($l['access']) && $l['access']) {
    $label = !empty($l['title']) ? $l['title'] : $l['link_title'];
    $output[] = array(
      'value' => $l['link_path'],
      'label' => $label,
      'command' => $command,
      'parent' => !empty($link['parent']) ? $link['parent'] : NULL,
    );
  }
  if (isset($link['below']) && is_array($link['below'])) {
    foreach ($link['below'] as $below_link) {
      if (isset($label)) {
        $below_link['parent'] = $label;
      }
      coffee_traverse_below($below_link, $output);
    }
  }
}