Skip to main content
Use correct function name to retrieve the menu tree
Source Link

I'm trying to programmatically build a menu on my site, it works fine on all pages except a search view. This code I'm using is below:

        $config = array('menu_name' => $menu_name, 'level' => 2, 'depth' => 10, 'expanded' => true);
        $menu_tree = menu_tree_buildmenu_build_tree($config);

When I do a var_dump() of $menu_tree it has a content key in the array which has all the menu items, but only if the page is a 'normal' node. If it's the search results view then that array key is empty.

Does anyone have any idea why this is?

I also have two custom functions to change the output of the menu however these don't seem to be called as if I do a var_dump("test") at the start of them it has no affect. The two custom methods are:

THEME_menu_tree__menu_footer_links_1()
THEME_menu_link__menu_footer_links_1()

I'm trying to programmatically build a menu on my site, it works fine on all pages except a search view. This code I'm using is below:

        $config = array('menu_name' => $menu_name, 'level' => 2, 'depth' => 10, 'expanded' => true);
        $menu_tree = menu_tree_build($config);

When I do a var_dump() of $menu_tree it has a content key in the array which has all the menu items, but only if the page is a 'normal' node. If it's the search results view then that array key is empty.

Does anyone have any idea why this is?

I also have two custom functions to change the output of the menu however these don't seem to be called as if I do a var_dump("test") at the start of them it has no affect. The two custom methods are:

THEME_menu_tree__menu_footer_links_1()
THEME_menu_link__menu_footer_links_1()

I'm trying to programmatically build a menu on my site, it works fine on all pages except a search view. This code I'm using is below:

        $config = array('menu_name' => $menu_name, 'level' => 2, 'depth' => 10, 'expanded' => true);
        $menu_tree = menu_build_tree($config);

When I do a var_dump() of $menu_tree it has a content key in the array which has all the menu items, but only if the page is a 'normal' node. If it's the search results view then that array key is empty.

Does anyone have any idea why this is?

I also have two custom functions to change the output of the menu however these don't seem to be called as if I do a var_dump("test") at the start of them it has no affect. The two custom methods are:

THEME_menu_tree__menu_footer_links_1()
THEME_menu_link__menu_footer_links_1()
Source Link
Neil Nand
  • 306
  • 2
  • 14

Programmatically render menu on search view

I'm trying to programmatically build a menu on my site, it works fine on all pages except a search view. This code I'm using is below:

        $config = array('menu_name' => $menu_name, 'level' => 2, 'depth' => 10, 'expanded' => true);
        $menu_tree = menu_tree_build($config);

When I do a var_dump() of $menu_tree it has a content key in the array which has all the menu items, but only if the page is a 'normal' node. If it's the search results view then that array key is empty.

Does anyone have any idea why this is?

I also have two custom functions to change the output of the menu however these don't seem to be called as if I do a var_dump("test") at the start of them it has no affect. The two custom methods are:

THEME_menu_tree__menu_footer_links_1()
THEME_menu_link__menu_footer_links_1()