You are here

function menu_block_split_block_view in Menu Block Split 7.2

Implements hook_block_view().

This hook generates the contents of the blocks themselves.

File

./menu_block_split.module, line 177
Allow a menu to be split over two blocks Developed by Robert Garrigos <robert@garrigos.cat> Modified for Drupal 6.x by Frank Meyerer <meyerer@digi-info.de> http://www.digi-info.de currently maintained by Bob Hutchinson…

Code

function menu_block_split_block_view($delta = '') {
  $howmany = variable_get('menu_block_split_howmany', 1);
  $block = '';

  // Delta 0 is the 2nd level block
  if ($delta > 0) {
    $tree = menu_tree_page_data(variable_get('menu_block_split_' . $delta, ''));
    $block['subject'] = check_plain(variable_get('menu_block_splittitle_' . $delta, ''));
    $block['content'] = theme('menu_block_split_menu', array(
      'link' => variable_get('menu_block_split_' . $delta, ''),
      'tree' => $tree,
      'level' => $delta,
    ));
  }
  else {
    $current_router_item = menu_get_item();
    for ($i = 1; $i <= $howmany; $i++) {
      $name = variable_get('menu_block_split_' . $i, '');

      // now returns an array
      $active_arr = menu_get_active_menu_names();
      foreach ($active_arr as $active) {
        if ($active == $name) {
          $trail = menu_get_active_trail();
          $tree = menu_tree_page_data($name);
          $info = menu_block_split_get_first_level($trail);
          $block['subject'] = $info['title'];
          $block['content'] = theme('menu_block_split_menu', array(
            'link' => $name,
            'tree' => $tree,
            'level' => $delta,
          ));
          return $block;
        }
      }
    }
  }
  return $block;
}