I have a View called 'tag-list'. It displays a list of all taxonomy terms that in the Tag list vocabulary.
I have used this module to create a 'tag-list' menu.
I have a menu called Navi which contains two lists. I have attached my 'tag-list' menu so it is a child of a link on the Navi menu.
My menu is output as follows:
<ul class="menu"> <-- This is the Navi Menu
<li> Link </li>
<li> Link
<ul class="menu">
<li>
<ul class="menu">
<li> Views Menu </li>
</ul>
</li>
</ul>
</li>
<ul>
The Menu View seems to be having an unnecessary UL tag.
Surely the output should be like this:
<ul class="menu"> <-- This is the Navi Menu
<li> Link </li>
<li> Link
<ul class="menu">
<li>Views Menu </li>
</ul>
</li>
</ul>
How can I fix this?
Comments
Comment #1
Smartforcedev commented+1
Would be nice to have this fixed.
Comment #2
markhalliwellThis module is only responsible for outputting the view, not the markup inside the view.
Other modules that control the theming of a menu (be a theme or sub-module like Superfish are also responsible, not this module).
Comment #3
big_smile commentedIt's the module that is creating the extra tags. If I delete the wrapper UL tags from Views, this module still inserts its own LI and UL tags.
The LI tags come from line 80 of the module:
If I change it to the following the extra LI tags disappear:
return $view . $sub_menu ;I am not sure where in the module the UL tags come from.
It would be good if the module gave the option of disabling the UL and LI tags.
Comment #4
markhalliwell.
Comment #5
Chris Gillis commented+1
Comment #6
Chris Gillis commentedI tried overriding in my theme, but that is not working... It never gets that far. It executes in the module but not in the theme override.
#3 makes everything work but I don't really want to hack the module... Any ideas?
BTW, The reason I need to get rid of this is to get nice menus module to work... My view is a list of
<li>s, so having one at the root of the view means I end up with a structure like<li><li></li><li></li></li>which breaks everything.Comment #7
Chris Gillis commentedComment #8
markhalliwellAs stated above, and to expand on my comment in #2.
Any
<ul>element will come from the parent/current menu element. This is not detectable or modifiable, in any way, from the link "level" (i.e. menu_views_menu_link, which is a theme_menu_link() override). This simply is not possible.This is necessary because it's already in a menu structure (the parent/current menu
<ul>element). Simply adding the view (with whatever markup it's spitting out) has the potential for the markup to become semantically and logically incorrect (see the "Permitted contents" section of https://www.w3.org/TR/html-markup/ul.html). This means that how each and every browser interprets the markup may differ if not followed. That is why it is wrapped in an<li>element, which allows any type of child (see the "Permitted contents" of https://www.w3.org/TR/html-markup/li.html#li).If someone provided a patch for this, I may entertain the idea of being able to toggle at least the
<li>tag. The<ul>tag cannot be toggled, as mentioned above. However, this is also under the assumption that the view itself is configured properly to spit out just<li></li>elements (with no wrapping<ul>element).---
Regardless, I'm closing and marking as "Closed (won't fix)" since a) the entire output is specifically "by design", b) no one has actually provided a patch and c) this issue is over 3 years old with no real interest/comments to justify time spent on it.
Do not re-open unless you plan to create a patch that provides this feature.