function menu_block_menu_tree_content_type_render in Menu Block 7.3
Same name and namespace in other branches
- 6.2 plugins/content_types/menu_tree/menu_tree.inc \menu_block_menu_tree_content_type_render()
- 7.2 plugins/content_types/menu_tree/menu_tree.inc \menu_block_menu_tree_content_type_render()
Renders a menu_tree content type based on the delta supplied in the configuration.
Parameters
$subtype:
$conf: Configuration as done at admin time.
$args:
$context: Context; in this case we don't have any.
Return value
object An object with at least title and content members.
File
- plugins/
content_types/ menu_tree/ menu_tree.inc, line 80 - Provides ctools integration for "Menu block" trees.
Code
function menu_block_menu_tree_content_type_render($subtype, $conf, $args, $context) {
// Ensure the delta is unique.
$ids =& drupal_static(__FUNCTION__, array());
if (empty($ids[$conf['menu_name']])) {
$ids[$conf['menu_name']] = 0;
}
$delta = ++$ids[$conf['menu_name']];
$conf['delta'] = 'ctools-' . $conf['menu_name'] . '-' . $delta;
$tree = menu_tree_build($conf);
$block = new stdClass();
$block->module = 'menu_block';
// Add contextual links.
menu_block_block_view_alter($tree, $block);
$block->subtype = isset($tree['content']['#config']['menu_name']) ? $tree['content']['#config']['menu_name'] : $conf['menu_name'];
$block->title = $tree['subject'];
$block->title_array = $tree['subject_array'];
$block->content = $tree['content'];
return $block;
}