You are here

function webmaster_menu_create_datastructure_from_tree in Webmaster menu 7

Build a datastructure suitable for theme_webmaster_menu_tree.

Parameters

array $tree: A tree structure like the returned by menu_tree_all_data.

Return value

array A data structure suitable for theme_webmaster_menu_tree().

1 call to webmaster_menu_create_datastructure_from_tree()
webmaster_menu_get_tree in ./webmaster_menu.module
Get a tree.

File

./webmaster_menu.module, line 289
Display a dropdown menu at the top of the window.

Code

function webmaster_menu_create_datastructure_from_tree($tree) {
  $new_menu_list = array();
  foreach ($tree as $element) {

    // Skip disabled links.
    if ($element['link']['hidden'] == 1) {
      continue;
    }
    $new_menu_item = webmaster_menu_create_menu_item($element['link']['title'], $element['link']['href'], array(), $element['link']['localized_options']);
    if (isset($element['below']) && count($element['below']) > 0) {
      $new_menu_item['classes'][] = 'expanded';
      $new_menu_item['children'] = webmaster_menu_create_datastructure_from_tree($element['below']);
    }
    $new_menu_list[] = $new_menu_item;
  }
  return $new_menu_list;
}