The title might be a little confusing but couldn't think of anything else atm.
I've got a use case that needs views exposed filters (hierarchical taxonomy terms) structured like the "Nested Checkboxes/Radio Buttons" but with a twist:
Instead of checkboxes or radio buttons I need links.
Sort of like a "Nested Links" display. (hence the title of this issue)
We've got "Nested Checkboxes/Radio Buttons", we've got "Links", why not combine them into "Nested Links" ? From what I understand it wouldn't be too hard to implement and theming-wise it would make some things a lot easier!
over-simplified, having an output like
<ul>
<li><a href=#>term 1</a></li>
<li><a href=#>term 2</a>
<ul>
<li><a href=#>sub-term</a></li>
</li>
</li>
<li><a href=#>term 3</a></li>
</ul>
would mean easier to theme hierarchical exposed filters, plus the ability to use a few js tricks to make this prettier and more functional.
Comments
Comment #1
DanielWashbrook commentedI was in the same situation. To save a bit of time, I copied the theme function code in better_exposed_filters.theme function theme_select_as_tree for counting depth
And then wrapped a div tag around the link with a depth class
and then I can style the different depth levels that I need. Not a great solution, but it works.
Here's the whole thing to go into your template.php file:
Daniel
Comment #2
aristeides commentedWow, thank a lot! that actually works!!
Comment #3
hanskuiters commentedBit of an old threat, but here is my tweak for a real nested links list.
Edit: I removed the code from this post because of bugs. See post #5.
Comment #4
openhairpinleft commentedCapono, you rock! Thanks a lot for this solution, it's excellent.
I know it's easy to make suggestions, but maybe you could consider to contribute the code to the BEF or Views itself. Drupal needs this facility as an output plugin.
Cheers
Comment #5
hanskuiters commentedThanks. There were some bugs in post #3, so here is a better one. Put this code in your temple.php file in your theme folder and change the function name to your theme name.
Comment #6
mikeker commentedIt sounds like folks have found a solution for this in the theme layer. If anyone can post a patch that turns this into a BEF option, I'd be happy to review and commit it. Until then, I'm going to mark this as closed. I've linked to this issue from the BEF docs so hopefully folks will find and continue to contribute to it.
Thank you to DanielWashbrook and capono for posting your solutions!
Comment #7
amirtaiar commentedThank you, I just need this option on a website I develop.
I didn't really understand the flow -
- I have put this code in my templete.php file and change the YOURTHEME to the name of my theme.
- Create a views page with 2 exposed fllters [Terms fields] that display in a block.
Yet I don't see any change in the html.
Comment #8
jbfelix commentedGo to admin/config/development/performance and delete the cache.