I want to have a view displayed as a menu either in primarylinks or secondarylinks.
I searched and looked up all modules with no luck.
should I build this functionality manually ==> build a module?
thanks in advance
I want to have a view displayed as a menu either in primarylinks or secondarylinks.
I searched and looked up all modules with no luck.
should I build this functionality manually ==> build a module?
thanks in advance
Primary and secondary links (in fact, all menus) are rendered as unordered lists of links using a theme function like theme_links()
. You can get pretty close to the same functionality by using the HTML List style within a view.
You can't duplicate it exactly because Drupal's menu system requires static menu items: it doesn't handle wildcards like the results of a query.
That is, Drupal's menu system is cached, and is only rebuilt upon request (e.g. by adding a menu item manually, clearing the cache, etc.) A view, on the other hand, is a wrapper to a query: every time you access the view, unless it too is cached, it runs a query to get the latest results.
So, if you were to inject a view into a menu, it'd only be the results at the time of first request, and any subsequent changes would require rebuilding the menu.
The solution I suggested will let you keep the functionality of the view, theme it to look like a menu, and avoid the caveats of the menu system.