Hi!

Since I had problems whit marinelli megamenu whit more that 3 second tier childs, whit deactivated links, etc., I was searching for a solution. I found the megamenu module that accept more that 3 second tier childs and have no problem whit deactivated links, etc.

My problem is to override the marinelli megamenu and replace it whit the block megamenu module. I'm looking into the code now, I tried some rapid fix that does not work. I will go deeper next, I would like some advice as how and where to change this.

Maybe the theme should use this module since it is a better megamenu?

Thx!

Comments

Dadaisme’s picture

It should read "more than 4 second tier childs" ...

Dadaisme’s picture

My rapid fix was:

Adding an 3rd option in theme-settings.php in

  // Menu elements
  $form['menu']['menu_type'] = array(
    '#type' => 'select',
    '#title' => t('Which kind of primary links do you want to use?'),
    '#description' => t('Classic one-level primary links, or mega drop-down menu'),
    '#options' => array(
      1 => t('Classic Primary Links'),
      2 => t('Mega Drop Down'),
      3 => t('Other block menu'), 
    ),
    '#default_value' => theme_get_setting('menu_type'),
  );

So that in the template.php in the // MENU SECTION the $vars['mainmenu'] whould come out empty.

  // MENU SECTION ==============================================================
  // secondary links with <span>
  $links = $vars['secondary_menu'];

  foreach ($links as $key => $link) {
    $links[$key]['html'] = TRUE;
    $links[$key]['title'] = '<span>' . $link['title'] . '</span>';
  }

  $vars['secondary_menu'] = $links;

  // primary links markup
  if (theme_get_setting('menu_type') == 2) { // use mega menu
    $vars['mainmenu'] = theme('mega_menu', array('menu' => menu_tree_all_data(theme_get_setting('menu_element'))));
  }
  elseif (theme_get_setting('menu_type') == 1) {
    if (theme_get_setting('menu_headings') == 1) { // use classic <li>
      $vars['mainmenu'] = theme('links', array('links' => $vars['main_menu'], 'attributes' => array('id' => 'primary', 'class' => array('links', 'clearfix', 'main-menu'))));
    }
    elseif (theme_get_setting('menu_headings') == 2){ // use <h2> (custom_links in theme/theme.inc)
      $vars['mainmenu'] = theme('custom_links', array('links' => $vars['main_menu'], 'attributes' => array('id' => 'primary', 'class' => array('links', 'clearfix', 'main-menu'))));
    }
  }
  /*elseif (theme_get_setting('menu_type') == 3) { // Other menus as block
	// $vars['mainmenu'] = "where's that block?";
  }*/

Next step was setting the value to 'Other block menu' in the setting page and tryed getting the megamenu block in the advertise region in the block page "admin/structure/block/list/". But whatever the block added to this region, nothing is outputed.

So, I'm looking at "why there is no output in the advertise region ?", and I'm trying to add an elseif statement for the 'Other block menu' option in template.php (see the previous code) for getting blocks outputed there.

Thx!

Dadaisme’s picture

Well, it's not elegant, but I've come out whit this: calling directly the megamenu_theme_menu_tree() function in the marinelli/template.php file.

It would be a better solution if any megamenu could be used.

  // MENU SECTION ==============================================================
  // secondary links with <span>
  $links = $vars['secondary_menu'];

  foreach ($links as $key => $link) {
    $links[$key]['html'] = TRUE;
    $links[$key]['title'] = '<span>' . $link['title'] . '</span>';
  }

  $vars['secondary_menu'] = $links;

  // primary links markup
  if (theme_get_setting('menu_type') == 2) { // use mega menu
    $vars['mainmenu'] = theme('mega_menu', array('menu' => menu_tree_all_data(theme_get_setting('menu_element'))));
  }
  elseif (theme_get_setting('menu_type') == 1) {
    if (theme_get_setting('menu_headings') == 1) { // use classic <li>
      $vars['mainmenu'] = theme('links', array('links' => $vars['main_menu'], 'attributes' => array('id' => 'primary', 'class' => array('links', 'clearfix', 'main-menu'))));
    }
    elseif (theme_get_setting('menu_headings') == 2){ // use <h2> (custom_links in theme/theme.inc)
      $vars['mainmenu'] = theme('custom_links', array('links' => $vars['main_menu'], 'attributes' => array('id' => 'primary', 'class' => array('links', 'clearfix', 'main-menu'))));
    }
  }
  elseif (theme_get_setting('menu_type') == 3) { // Other megamenus
	$vars['mainmenu'] = megamenu_theme_menu_tree('main-menu');
  }

What's left is making a megamenu skin for my marinelli subtheme.

Thx.

drwierdo’s picture

Hey,
I too was looking for this solution. the megamenu used by the theme is good, but it has many problems. since, there is a dedicated module for this function, it would be nice if the theme used it for rendering the megamenu. And the megamenu of the theme has some bugs, for instance, it does not take functions defined by the "void menu". So, this solution that you have mentioned is an ideal one. But I am having problem with its implemetation. Can you please explain step by step how you accomplished this???