Love the module, but I have an issue.
I want to style the accordion so that there is a unique colour per section. This would mean that I would need something like:
<div class="container-1">
<h3>title</h3>
<div>menu</div>
</div>
<div class="container-2">
<h3>title 2</h3>
<div>menu2</div>
</div>
Obviously that is cut down output.
The current output displays the header and children seperately like so:
<h3>title</h3>
<div>menu</div>
<h3>title 2</h3>
<div>menu2</div>
This is impossible to style in my situation as the children don't have any style corresponding to the headers.
I can't work out how to wrap the H3|Div combo with another div to get this result. Any ideas?
Comments
Comment #1
solotandem commentedThat seems like a useful feature.
We could add an alter hook in accordion_menu_output() passing you the $output string and let you do whatever to the rendered menu items. Would you know how to do that?
And we could add a numbered class to them so you could do style each section. To accommodate the accordion JavaScript, the class may need to be on the h3 element instead of adding a div. Can you modify the code to try that and report back? If so, you could attach a patch. If not, then let me know.
Comment #2
Chris Graham commentedHeading classes
Just remembered why my first example doesn't work after you said there about the javascript. Forgot that jQueryUI accordion expects the content to follow the header, so you can't wrap the sections.
I just did a Firebug test to see how the currently rendered components would work with a background colour and it turns out that all we would need to do is to patch accordion_menu_output to add extra classes to the headers and content.
I've rolled that into the attached patch.
Headings links options
I also added a new admin option with a bit of javascript for another problem (not sure if it should have had a different patch but I rolled it into this one for now - I can reroll as separate patches if necessary).
Any time I've been adding an accordion to a website, and any time I've seen one, the headers act as a way of grouping links. In this module they tend to be active links. What I've done is make an option to say when to make the header links active. It defaults to Never, but can be set to Always and When a header element has no children.
This will mean that people can choose how it should work. I added a README file to explain the use of the option.
Comment #3
katrialesser commentedIs there any way to make these changes manually? I'm on windows and it has been difficult (so far not working) to apply patches using eclipse.
Also, will this not work for drupal 6 then? Or what would be different? Thanks!
Thanks for the patch, these are valuable changes.
Comment #4
solotandem commentedImplemented in this commit.
Please grab the latest dev release (created after this comment) or commit to 7.x branch, test, and report back.