function _menu_block_block_view in Menu Block 5
Same name and namespace in other branches
- 5.2 menu_block.module \_menu_block_block_view()
- 6.2 menu_block.module \_menu_block_block_view()
Returns the 'view' $op info for hook_block().
Parameters
$delta: string The name of the block to render.
File
- ./
menu_block.module, line 73
Code
function _menu_block_block_view($delta) {
$data = array();
// Determine which menu and what level of the menu has been requested.
$mid = variable_get("menu_block_{$delta}_mid", 1);
$level = variable_get("menu_block_{$delta}_level", 1);
// Render the block if the active menu item is in this menu.
if ($level == 1 || menu_in_active_trail($mid)) {
if ($level != 1) {
// Get the menu item of the n-level link in the active trail.
$active_trail = _menu_get_active_trail();
$mid = $active_trail[$level - 1];
}
$menu_item = menu_get_item($mid);
$data['subject'] = check_plain($menu_item['title']);
$depth = variable_get("menu_block_{$delta}_depth", 0);
if ($depth == 1) {
$data['content'] = theme('menu_block_list', $mid);
}
else {
$expanded = variable_get("menu_block_{$delta}_expanded", 0);
$data['content'] = theme('menu_block_tree', $mid, $depth, $expanded);
}
}
return $data;
}