You are here

function responsive_menu_block_view in Responsive and off-canvas menu 7.2

Same name and namespace in other branches
  1. 7.3 responsive_menu.module \responsive_menu_block_view()
  2. 7 responsive_menu.module \responsive_menu_block_view()

Implements hook_block_view().

File

./responsive_menu.module, line 84

Code

function responsive_menu_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'toggle':
      return array(
        'subject' => '',
        'content' => theme('responsive_menu_block_toggle'),
      );
    case 'horizontal_menu':
      module_load_include('inc', 'responsive_menu', 'includes/responsive_menu.menu');

      // Get the menu name of the menu to be rendered.
      $menu_name = variable_get('responsive_menu_menu', 'main-menu');

      // Allow the menu name to be altered.
      drupal_alter('responsive_menu_horizontal_menu_name', $tree);

      // Get the maximum depth the horizontal menu will display.
      $depth = variable_get('responsive_menu_depth', 3);

      // Get the raw menu tree data.
      $tree = responsive_menu_tree_block_data($menu_name, $depth);

      // Allow the tree to be altered.
      drupal_alter('responsive_menu_horizontal_tree', $tree);
      return responsive_menu_tree_build($tree, $menu_name);
  }
  return $block;
}