function _menu_block_block_view in Menu Block 5.2
Same name and namespace in other branches
- 5 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 127 - Provides configurable blocks of menu items.
Code
function _menu_block_block_view($delta) {
$data = array();
// Get the block configuration options.
$mid = variable_get("menu_block_{$delta}_menu_name", 1);
$level = variable_get("menu_block_{$delta}_level", 1);
$depth = variable_get("menu_block_{$delta}_depth", 0);
$expanded = variable_get("menu_block_{$delta}_expanded", 0);
// 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']);
$data['content'] = theme('menu_block_tree', $mid, $depth, $depth == 1 ? FALSE : $expanded);
}
return $data;
}