Use case: embedding a view which holds an accordion inside another view also displaying as accordion.
Currently the accordions do not work as expected (independently of eachother).
To reproduce you can use views_field_view module.
Proposed solution: Change the accordion header class to be unique per accordion.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | interdiff.txt | 2.07 KB | manuel garcia |
| #8 | support_for_nested-2854861-8.patch | 1.99 KB | manuel garcia |
| #6 | nested-accordion-content-height.png | 7.21 KB | manuel garcia |
| #6 | support_for_nested-2854861-6.patch | 547 bytes | manuel garcia |
| #5 | views_accordion-nested-2854861-1-8.x-1.x.patch | 1.24 KB | nor4a |
Comments
Comment #2
nor4a commentedComment #3
nor4a commentedComment #4
manuel garcia commentedThanks @Nor4a for the patch!
First a note that we follow drupal's coding standards on this project :)
On your patch:
Not a show stopper of course but it means the maintainer would have to spend more time to clean up your patch before committing which might get in the way of your patches getting accepted ;-)
About the patch itself, I will eventually find the time to play around with it. For now after a quick read, I can tell you that I'm not terribly a fan of using a static variable for this, and would like more people to test it and have a look at it in the mean time.
Comment #5
nor4a commentedFixed coding issues and simplified the patch (without static variable).
It seams that previous version did not work with PHP 7.
Comment #6
manuel garcia commentedThanks @Nor4a for following up. #5 looks a lot better.
I spent some time on this today. tested using views_field_view:
This is not necessary. You can simply set

heightStyleto content in the accordion settings, and the nested accordion's content will show up fine. We should probably document this so that people doing nested accordions are aware of it.I have reworked your patch a bit so it applies to 8.1.x. It's just a one line change now.
I would like others to test this before committing it, specially people with running sites since we are changing one class that perhaps themers were relaying on.
Comment #7
manuel garcia commentedComment #8
manuel garcia commentedI've had a thought about this, and we should keep the previous css class in place, and add the new one with the
dom_idbesides it, so not to break current installations that might have used this for theming already.Attached patch does this, please kindly test and report what you find =)
Comment #10
manuel garcia commentedComment #11
heddnIf I nested a view inside of a view, inside of a 3rd view, this still doesn't seem to work.
Comment #12
manuel garcia commentedThanks for testing @heddn!
Was any of the three the same view / display? (wondering if they had the same dom_id)