I'm trying to transform my primary link menu block in a jquery accordion menu (link text). I've tested the Accordion Menu module for Drupal, but it does not function for me.
For my Primary Links Block I would have more or less this html output:
<ul id="accordion">
<li>
<a href="#recent" class="heading">Recent Entries</a>
<ul id="recent">
<li><span class="date">01.19.2009</span> <a href="#">Recent Entry Title</a></li>
<li><span class="date">01.15.2009</span> <a href="#">Recent Entry Title</a></li>
<li><span class="date">01.13.2009</span> <a href="#">Recent Entry Title</a></li>
<li><span class="date">01.11.2009</span> <a href="#">Recent Entry Title</a></li>
<li><span class="date">01.10.2009</span> <a href="#">Recent Entry Title</a></li>
</ul>
</li>
<li>
<a href="#recent" class="heading">Recent Entries</a>
</li>
<li>
<a href="#popular" class="heading">Popular Entries</a>
<ul id="popular">
<li><span class="date">08.16.2008</span> <a href="#">Popular Entry Title</a></li>
<li><span class="date">06.12.2008</span> <a href="#">Popular Entry Title</a></li>
<li><span class="date">04.12.2008</span> <a href="#">Popular Entry Title</a></li>
<li><span class="date">06.12.2007</span> <a href="#">Popular Entry Title</a></li>
<li><span class="date">03.12.2007</span> <a href="#">Popular Entry Title</a></li>
</ul>
</li>
<li>
<a href="#categories" class="heading">Categories</a>
<ul id="categories">
<li><a href="#">Category Name</a> <span class="count">7</span></li>
<li><a href="#">Category Name</a> <span class="count">4</span></li>
<li><a href="#">Category Name</a> <span class="count">15</span></li>
<li><a href="#">Category Name</a> <span class="count">29</span></li>
<li><a href="#">Category Name</a> <span class="count">8</span></li>
</ul>
</li>
</ul>
I have some primary links with child:
- Territory
- Map
- Gallery
- Products
- Wine
- Glasses
- Contacts
Devel Themer Module says that I must override "theme_menu_item" function but I don't know how to proceed. Can I reach my goal only editing this function in the "template.php" file?
I'm sure that jQuery and jQuery UI are working well beacuse I've tested them with the above code in page.tpl.php.
Any ideas?
Thanks
Bye
EDIT
I've read a lot of docs and drupal forums, but I can't find a similar request. I can simply edit only primary links html without child using this code that add id tag to ul
function basic_menu_tree($tree) {
return '<ul id="accordion" class="menu">'. $tree .'</ul>';
}
The problem comes with child ul, in fact the above function add id="accordion" tag also on child ul with bad effect to jquery script
I want to customize only Primary Link menu block html and I can't believe there are no solutions... Thanks
UPDATE
I've resolved using above function in template.php file and adding a header class through jquery script to primary link parents to setting jquery ui accordion header options (http://jqueryui.com/demos/accordion/#option-header)!
Bye