You are here

function menu_block_menu_tree_content_type_render in Menu Block 6.2

Same name and namespace in other branches
  1. 7.3 plugins/content_types/menu_tree/menu_tree.inc \menu_block_menu_tree_content_type_render()
  2. 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 77
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.
  static $ids = 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->subtype = $conf['menu_name'];
  $block->title = $tree['subject'];
  $block->content = $tree['content'];
  return $block;
}