Hello and thanks for the module!

I would like to use this with a custom menu tree that is built dynamically rather than from the Drupal menu subsystem. I have been doing a similar thing with nice menus which supports this kind of use case.

It would just take a little refactoring of megamenu_theme_menu_tree() so that the tree structure and display options are passed as arguments. Patch to follow...

Andy

CommentFileSizeAuthor
#1 megamenu-928538.patch3.48 KBchaps2
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chaps2’s picture

FileSize
3.48 KB

Patch as promised. This is against HEAD.

It just adds a new function megamenu_theme_menu() as below:

 * @param $menutree
 *    The menu tree structure to be marked up.
 * @param $id
 *    Unique id - e.g. the menu name.
 * @param $options (optional)
 *    An associative array of display options:
 *    - 'menu_orientation': either 'horizontal' or 'vertical'. Defaults to 'horizontal'.
 *    - 'slot_orientation': either 'columnar' or 'stacking'. Defaults to 'columnar'.
 *    - 'slot_attributes': not supported yet.
 *    - 'skin': a valid skin. Defaults to 'minimal'.
 * @return
 *    HTML markup for a mega menu
 *
 */
function megamenu_theme_menu($menutree, $id, $options = NULL) {...}

One thing to make sure of is that the links in the menu tree structure include 'link_title' and 'link_path' attributes. I think nice menus uses the 'title' and 'href' attributes.

chaps2’s picture

Status: Active » Needs review
vlooivlerke’s picture

Hi I tried this patch but did not see a list with my custom menu tree.

I can call my menu via the theme template the same way I call all other drupal menus.
Here I add a <span> class to it

function mytheme_menu_item_link($link) {
  if (empty($link['options'])) {
    $link['options'] = array();
  }

  if (empty($link['type'])) {
    $true = TRUE;
  }
  
  // Do special stuff for PRIMARY LINKS or Any Menu with the NAME here
  if ($link['menu_name'] == 'primary-links') {
    $link['title'] = '<span>' . check_plain($link['title']) . '</span>';
    $link['options']['html'] = TRUE;
  }

Will It not be possible to set non drupal menus as mega-menus by simply entering the [menu_name] in a field and save to edit megamenu settings.