Menu for a category listing page.
This is a specialized version of system_admin_menu_block_page(), which retrieves all direct child menu links of the current page, regardless of their type, skips default local tasks, and outputs them as a simple menu tree as the main page content.
string $category: The design test category being currently accessed. Maps to the subdirectory names of this module.
array A render array containing a menu link tree.
public function categoryPage($category) {
$link = menu_link_get_preferred();
$tree = menu_build_tree($link['menu_name'], array(
'expanded' => array(
$link['mlid'],
),
'min_depth' => $link['depth'] + 1,
'max_depth' => $link['depth'] + 2,
));
// Local tasks are hidden = -1, so normally not rendered in menu trees.
foreach ($tree as &$data) {
// Exclude default local tasks.
if (!($data['link']['type'] & MENU_LINKS_TO_PARENT)) {
$data['link']['hidden'] = 0;
}
}
return menu_tree_output($tree);
}