You are here

function megamenu_block in Megamenu 6.2

Same name and namespace in other branches
  1. 6 megamenu.module \megamenu_block()

Implementation of hook_block()

I think there will be problems with how these are being referenced will need a table for "enabled megas" or something sooner than later?

File

./megamenu.module, line 106
megamenu-Menu Builder

Code

function megamenu_block($op = 'list', $delta = '0', $edit = array()) {
  switch ($op) {
    case 'list':
      $block_count = 0;
      $menus = _megamenu_enabled_menus();
      if ($menus) {
        foreach ($menus as $menu_name) {
          $menu_details = menu_load($menu_name);
          $blocks[$block_count]['info'] = t('Megamenu - ' . $menu_details['title']);
          $blocks[$block_count]['cache'] = BLOCK_NO_CACHE;

          //set this to true for production version?
          ++$block_count;
        }
      }
      return $blocks;
      break;
    case 'view':
      $menus = _megamenu_enabled_menus();
      $output = theme('megamenu_menu_tree', $menus[$delta]);
      $block['subject'] = '';

      // TODO: temp debugging value, should be left unset in production
      $block['content'] = $output;
      return $block;
      break;
    case 'configure':
      break;
    case 'save':
      break;
  }
}