I can attach only one view to menu item. How to attach two or more views to one menu item?

Comments

markhalliwell’s picture

Assigned: Unassigned » markhalliwell
Priority: Normal » Minor
Status: Active » Fixed

That is not the scope of this module. You should probably use the views_field_view module if you want to attach multiple views to one.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

markhalliwell’s picture

Title: I can attach only one view to menu item. How to attach two or more views to one menu item? » Multiple views on one menu item
jmary’s picture

Category: Support request » Feature request
Priority: Minor » Normal
Issue summary: View changes

It seems that views_field_view is not taken in consideration in the module.

In the function menu_views_menu_link, the way to test the wrapping into <li> does not parse the code sent by the view but simply test if there is something in

$variables['element']['#below']

It is appearing at line 79-81 in menu_views.module

      if ($variables['element']['#below']) {
        $sub_menu = drupal_render($variables['element']['#below']);
      }

Therefore a sub element is built only if it is a subelement in the drupal menu system, not in the generated view. That's how things seem to work here.

So it seems that there is no way to render correctly anything else than a view which is reflecting a flat menu. I have been on that during the past 3 days.

jmary’s picture

Version: 7.x-1.3 » 7.x-2.2
Status: Closed (fixed) » Active

Sorry to reopen that, but it would be nice if the module could handle any view as long as it is feeded with a menu structure, and not only flat elements.

Think about a views spitting this :

<a href="category/term1">Term1</a>
<ul>
    <li><a href="archive/2014">2014</a></li>
         <ul>
                 <li><a href="archive/2014/01">Jan</A></li>
                       <ul>
                             <li><a href="node/id1">Title 1</a></li>
                             <li><a href="node/id2">Title 2</a></li>
                       </ul> 
                 <li><a href="archive/2014/02">Feb</a></li>
                 <li><a href="archive/2014/03">Mar</a></li>
                 ....
         </ul>
    </li>
    <li><a href="archive/2013">2013</a></li>
     .....
</ul>
<a href=<a href="category/term2">Term2</a>
.....

It just doesn't behave well : it will put the whole block in one <li> element whereas the <li> blocks should begin before the links which are not already in <li> block and finish after the <ul> blocks.

markhalliwell’s picture