Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is it possible to get views integration?
I have a set of views that have paths like "top/view1", "top/view2"... and I would like to have all these views to show under a menu items that happens to be at "top".
It would be nice if it was possible to map any path to a menu, an open ended list.
Comment | File | Size | Author |
---|---|---|---|
#26 | menutrails_views_support.patch | 489 bytes | chriscohen |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedI vote for this feature too
Comment #2
ar-jan CreditAttribution: ar-jan commentedI just wanted to make this feature request and then it happened to be there already.
This would be a really cool feature. I am very happy with what Menu Trails does not, works very well to assign a specific content type to a specific menu and keep it active.
But when a view is rendered, I loose my active menu... I've had no luck trying other methods to keep the right menu active.
Any chance of this making it into Menu Trails?
Comment #3
steve22 CreditAttribution: steve22 commentedSubscribe!
Would be great if we can make menu trail also work with aggregator pages (source and category pages) and user profile pages.
Comment #4
momper CreditAttribution: momper commentedsubscribe +1
Comment #5
drewish CreditAttribution: drewish commentedI guess I'm not understanding this issue... why can't you use's Views's menus? It seems to work fine for me.
Comment #6
momper CreditAttribution: momper commenteddo you generate path + menuitem in views?
or only the path? ... and the menuitem in the menu-administration ...
and do you work with pathauto?
there must be a fine difference of the usage ...
Comment #7
ar-jan CreditAttribution: ar-jan commentedRe #5 and #6, that could be the reason. I have not tried this since I already put all my views in nodes using Views Reference, but I was putting the menu items in the Menu administration, not in Views.
Comment #8
j0rd CreditAttribution: j0rd commentedI can't seem to figure out how to make this work with my views either.
Here's my setup.
/clothes -> page
/clothes/pants-list -> views page
/clothes/shirts-list -> views page
/clothes/shoes-list -> views page
then I display each clothes node, with pathauto under it's path
/clothes/pants-list/jeans
/clothes/shirts-list/polo-shirt
/clothes/shoes-list/rebook-shoe
So right now, I have my primary menu and secondary menu set to "Primary Menu" so when you click on clothes, you're displayed that page and then you enter a secondary menu of "Pants" "Shoes" "Shirts". I'd like the breadcrumb here to display "Home".
When you click on shoes list, I'd like it to show "Home > Clothes"
When you clikes on rebook, i'd like it to show "Home > Clothes > Shoes"
How can I make this work with Menu Trail? Maybe I'm missing something here...
Comment #9
frames CreditAttribution: frames commentedI can confirm this is working. This way:
1. Having a view with a menu item created in it (and obviously a path, which is mandatory). Works straight away.
2. Having a view and a menu item created from the menu module (the latter linking to the path defined in the view). Also works.
3. Having BOTH a view with a menu item created in it AND a menu item created from the menu.module at the same time (i.e., 1 + 2 above). First level (i.e. path defined in the view, e.g. "/dates") also works. BOTH menu items are "highlighted". BUT going to a second level (e.g. "/dates/2009") will only work for the menu item defined manually in the menu module.
I went even further and created:
a) a menu item in primary links created manually via menu.module
b) a menu item in secondary links created manually via menu.module
c) a menu item in secondary links created automatically via views
This case is just a variation of 3 above. The behaviour is the same: All the three links work for "/dates" (first level in the view). Only the menu items created from the menu module work going any deeper (e.g. "/dates/2009", "dates/2009/01" and so on).
CONCLUSION: Both menu items from the menu module and from views work. "Menu items created by hand in the menu.module" PREVAIL to "Menu items created in views". If you only have to show a menu item (regardless of being in primary or secondary links), both views menu items and "menu module items" are OK. If you have to show them twice and want all to show the menu trail info, just create menus by hand. As an aside, this is "safer" only for this case, but if you remove a view or modify its menu link, the menu created in the menu module won't disapear or follow the new path.
Hope I made sense.
Comment #10
frames CreditAttribution: frames commentedOK, once I tried to explain that this (and how) this is working, I'll try to explain why I think this SEEMS not to be working.
For those of you who do not see the "highligted menu", I believe this is because the theme you're using is not "menu-trails aware".
To check it, please do visit one of the pages where one of the links is "not working" for you. See the page source in your browser, look for the bit of text in the link you think should be highlighted. If you see an "active-trail" class in the
li
element "above" thea
element which contains the text you're looking for, that is OK. Just something like this:To do what you want in a simple way, just go to the theme you are using (/sites/all/themes/xxx), open the stylesheet file (style.css, normally), look for every "active" class that you see there and "replicate" that with "active-trail". All this does is apply the same style to items classed as active (the Drupal default) and active-trail (the Menu Trails "default").
For instance, in the darkelegance theme, I had to change this for the sidebar:
Into this:
If you do not understand that, just call a friend who knows CSS, buy him a beer and show him this comment ;-)
I think this Issue should be closed, but I'll let someone of those that said this was not working test, confirm and close it (developers will thank you). I'll turn the Category back to "support request" since the feature was already there.
All the best.
Comment #11
frames CreditAttribution: frames commentedJust to let you know I have actually seen one view where menu-trails is not working for me. I have to investigate it further, but it is related to taxonomy terms and I am not sure it is actually working incorrectly.
While I check it,
if some of you could also have a look at how your taxonomy-related views are working with menu trails, that would be cool.Edit: As I imagined, the view and menu-trails is also working OK for taxonomy terms. I have a problem with something else, but I'm not sure if it's either Tagadelic, Tagadelic Views, or the way I set up my views and term paths (both are the same).
Comment #12
nullpainter CreditAttribution: nullpainter commentedI also vote for this feature. The issue which I have which doesn't appear to be covered in the earlier posts, is that my view doesn't and shouldn't have a menu item.
I have a page on the website which displays the most recent blog item. On this page are links to blog categories. These blog categories pages are created by my view (using a page display type), which uses an views attribute to specify the category type.
To clarify, the URL of the blog is:
http://mysite/news_views/our_blog/
and a couple of paths to categories are:
http://mysite/news_views/our_blog/topic/1
http://mysite/news_views/our_blog/topic/2
http://mysite/news_views/our_blog/topic/3
The category page created by the view should not appear in my menu structure (and cannot, as it has an attribute), however needs to display the same menu as if the user was at the /news_views/our_blog/ path.
Clear as mud? ;)
Comment #13
nullpainter CreditAttribution: nullpainter commentedAs a workaround for my problem (namely, Menutrails not working for views that are exposed as pages and don't have associated menus), I wrote a function which arbitrarily sets the current menu path and uses Menutrails to set the breadcrumb as appropriate.
I then called the function in the header of my view:
Hopefully this will be useful to someone!
Comment #14
tbannister CreditAttribution: tbannister commentedI have a situation that menu trails doesn't seem to handle for me:
I have primary navigation (across the top) and secondary navigation (on the left). The primary navigation corresponds to a series of different views. The secondary navigation corresponds to a set of taxonomy terms that each view accepts as a parameter. I would like to keep the current view and current term active on their respective menus. Ideally I would be able to use menu trails to say "If a view was passed this parameter, this menu item should be active". Similarly, I would have liked to be able to tell menu trails "If this view is used regardless of parameters, this menu item should be active".
I didn't see a way to do either of these in the current menu trails module.
Comment #15
jrabeemer CreditAttribution: jrabeemer commentedMenu trails should be made to work with anything that acts like a page, namely Views Page and Panels Page. There's no node data but clearly the need is there.
Comment #16
dynamind CreditAttribution: dynamind commentedHere's a thought:
menutrails.module:
Works for me. I wrote about it here: http://www.touchdesk.nl/2009/04/making-menutrails-work-with-views-2-in-d...
Comment #17
awolfey CreditAttribution: awolfey commentedsubscribe
Comment #18
leenwebb CreditAttribution: leenwebb commentedmomendo has it exactly right -- there are things that act like pages that I want to use MenuTrails with. I'd love to see this functionality!
Comment #19
pmford CreditAttribution: pmford commentedsubscribe
Comment #20
TimG1 CreditAttribution: TimG1 commentedYes please! Subscribing!
Comment #21
mclaren CreditAttribution: mclaren commenteddynamind's patch works perfect for me too! I think this should be committed!
Comment #22
phl3tch CreditAttribution: phl3tch commenteddynamind's patch doesn't work for me. The path for my view has a wildcard. Could that be the reason?
Aside: is this module being maintained anymore? No commits since February 3.
Comment #23
glynster CreditAttribution: glynster commentedNot sure if this will be of any help to you all but just in case here is a possible solution to maintaining your menu trail as active when using views.
You do not actually need to use Menu Trails for this.
1. Go to your view and edit the "page settings" and add a menu. Make sure this is "normal menu entry".
2. Save and you will have a new entry appear in your main menu.
3. Go to your site-building/menus and edit your main menu.
4. Drag the newly created "view tab" under the "parent navigation" you want the menu trail to be active on.
5. Here is the trick, disable the "view tab" so this will hide the tab link from the menu.
Now when going to this view your main menu which you wanted active will be active. You can have multiple levels of children and the main tab will always be active.
Hope this helps as it sure helped me and one less module needed in my config :)
Comment #24
chriscohen CreditAttribution: chriscohen commenteddynamind's patch in comment #16 works a treat for me on 6.x-1.0 and 6.x-1.x-dev. I must admit I don't understand glynster in #23 at all. There are still no commits since February 2009, which is somewhat concerning given there are a number of patches waiting to be dropped into the dev branch. I'd like to see dynamind's patch committed.
Here is the situation for which the patch helped me:
Comment #25
sunPlease submit a proper patch. See http://drupal.org/patch for more information.
Comment #26
chriscohen CreditAttribution: chriscohen commentedComment #27
sunThanks for reporting, reviewing, and testing! Slightly fixed the coding style and committed to 6.x.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.
Comment #28
jrabeemer CreditAttribution: jrabeemer commentedDoes this support Panels pages?
Comment #30
libeco CreditAttribution: libeco commentedHi there,
I too (#22) can confirm that this patch does not seem to work for Views with arguments (like the taxonomy_term view provided by Views). I also have to confess I don't know how this patch could set a specified menu item to active.
I would also very much like to see a section to set a menu item to active for Views pages in the Menu Trails settings (I installed 6.x-1.x-dev and really had to look to find the new location admin/build/menu/trails, I had to look into the module file to find it actually :-P)
@ #23: while this method seems to work, it does seem to give an undesired result in the breadcrumb (or perhaps it somehow interferes with the Custom Breadcrumbs module).
Comment #31
pieterbezuijen CreditAttribution: pieterbezuijen commentedThe solution of nullpainter works for me, I use arguments in my view...
I'd love to see this in Menu Trails though.
Comment #32
jaybee1001 CreditAttribution: jaybee1001 commentedYes, nullpainter's solution works wonderfully for views with arguments. This would be cool to have in menu trails...
Comment #33
Bilmar CreditAttribution: Bilmar commentedHello, I was wondering if there is any update on Views integration of Menu Trails.
I installed the Dev version as I saw in #27 that the feature was developed and committed, but cannot seem to find the settings for views menu trails. I would appreciate any pointers. Thanks in advance!
Comment #34
momper CreditAttribution: momper commented+1
Comment #35
jrefano CreditAttribution: jrefano commented#13 works great for me. thanks a lot!
Comment #36
illuminatis CreditAttribution: illuminatis commentednullpainter's function works great for views and pages, nice work all of devs! ;)
Comment #37
Wolfgang Reszel CreditAttribution: Wolfgang Reszel commentedNullpainters function does not respect i18n. It always shows the default language for the view.
Comment #38
Xabraxas CreditAttribution: Xabraxas commentedMy solution to the views/menutrails problem was to remove menutrails altogether and use the CSS Injector module to style the active menu links based on path. This may or may not work for you depending on your setup.
Comment #39
sunI'm unable to locate a new patch here.
Comment #40
EurekaLiz CreditAttribution: EurekaLiz commentedThanks Xabraxas, your solution was great! I had tried before every module for achieving this (menutrails, breadcrumbs, context, etc., etc.) but there was always a dead end. They never worked as they should, or there was a drupal core limitation, or something else! This time I just needed to display an active menu item for certain content types and taxonomies depending on the url, but it was impossible until I tried this simple solution.
So meanwhile a full working solution is made, this is the module I will be using http://drupal.org/project/css_injector.
Comment #41
jp.stacey CreditAttribution: jp.stacey commentedI wanted this very thing but I've worked out a stopgap. Hopefully helping with some of the problems where people turn to Views<->Menu Trails integration, I've now written some d.o documentation on Putting a View-with-wildcard into a menu hierarchy using Panels.
This solves some of the use cases of integration, where people want a view at /blog/term/!term to have the context of some other menu item. Not the ones where people have multiple views, though.
Comment #42
xjmTracking.
Comment #43
lucuhb CreditAttribution: lucuhb commentedI am also interrested to display menutrail on page display of a view.
The solution I found is to add this in my template.php :
Comment #44
druplicate CreditAttribution: druplicate commentedUsing the CSS Injector module as suggested in #38 is a very simple solution if your site is hierarchically organized through the URL.
For example, if the URL is of the form: mysite.com/country/city/neighborhood/... and you're using a menu for selecting portions of a site based on "city", you just write CSS similar to this (in my case it's a custom menu button using the secondary menu):
That changes the color scheme of the menu button the same way the 'active' class would when using the Menu Trails module.
Then select "pages" to inject this CSS only on the selected pages as
thailand/bangkok/*
, for example.The key here is one additional module to assign a new CSS class with the same name as the menu item, to each 'li' element so you can target it. Just install the Menu CSS Names module and it happens automagically. Then it's just rinse and repeat for each menu item (city), a separate rule for each. Should you still need to use the Menu Trails module, this technique will work in parallel - if the Menu Trails module fails, this will take over. It works for any page even Views pages with paths that contain '%' for the argument.
Comment #45
andrewsuth CreditAttribution: andrewsuth commentedThe patch from #26 does not work with Views pages that have dynamic paths such as
node/%/mypage
I added this to
menutrails_init()
which has solved the issue for me.Idea borrowed from http://drupal.org/node/520106#comment-2487908
Comment #46
inetcom CreditAttribution: inetcom commentedJust in case someone looks for a solution whithout patching anything:
Use Insert View. You would use a regular content type e.g. page and with the activated input filter insert e.g.
[view:VIEWNAME=page_1=1]
VIEWNAME is the obviously the view's name.
page_1 is the first view
1 is the argument
You can add the page with a menu entry just as your are used to do.