Is there an existing way to integrate Nice Menu into the OG Menu?
Or any existing Drupal module for drop down menus.

If not, is this something that is possible to integrate?
I'm going to start looking at the module to determine where and how, but any thoughts would be appreciated.

peace,
michael

Comments

pelicani’s picture

My solution is to duplicate the OG Single block that is part of OG Menu.
The block calls theme_block, which I switched to call theme_nice_menu
eg. changed this ... $content .= theme('block', $block);
to this ... $nice_menu = theme('nice_menu', $delta, $menu['menu_name'], $mlid, 'down');

this fits with what we need to do /today/
but how would this be integrated to optionally display with nicemenu?
at this point I'm just curious to see if anyone else would have a need for this implementation.
... and how would it best be accomplished.

peace,
michael

rv0’s picture

Status: Active » Closed (won't fix)

Closing old issues. Re-open if needed

ñull’s picture

Version: 6.x-2.4 » 7.x-2.x-dev
Status: Closed (won't fix) » Active

I would like to see this at least for OG Single block, but for 7.x-2.x-dev or 7.x-3.x-dev. Better still to see this for the OG Menu : multiple block.

rv0’s picture

Category: support » feature
Status: Active » Closed (won't fix)

Checking how nice menus work, there's no place for supporting this in OG Menu code.
This should be handled in a contrib module.

mihai_brb’s picture

Here is some sample code that worked for us and does the following:

When you are on a group, if this group has a menu it adds the menu in a block called "OG Local Menu for Local Sites". This way you do not have to configure a block of nice menus for each group.

/**
 * Implements hook_block_info()
 */
function mymodule_block_info() {
  $items = array();

  // Define a custom block to render all local menus by context.
  $items['mymodule_og_nice_menu_block'] = array(
      'info' => t('OG Local Menu for Local Sites'),
      'cache' => DRUPAL_NO_CACHE
  );
}

/**
 * Implements hook_block_view()
 */
function mymodule_block_view($delta = '') {
  $block = array();
  $context = og_context();
  // Make sure we have a context
  if ($context && $delta == 'mymodule_og_nice_menu_block') {
    // Grab the menu for this local group from context.
    $menus = og_menu_get_group_menus(array(
        $context['group_type'] => array($context['gid'])
            ));
    // Make sure we have a menu for this group.
    if (!empty($menus)) {
      $block['content'] = '';
      // Render all menus one next to each other. If you only want the first one, change the foreach with the first element from $menus.
      foreach ($menus as $menu) {
        // Default settings. 
        // Since we do not have a block for each menu, we do not have this information stored as variables.
        $direction = 'down';
        $depth = '-1';
        // Here is where the magic happens.
        if ($output = theme('nice_menus', array('id' => $delta, 'menu_name' => $menu['menu_name'], 'direction' => $direction, 'depth' => $depth))) {
          $block['content'] .= $output['content'];
        }
      }
    }
  }
  
  return $block;
}