Closed (won't fix)
Project:
Views Accordion
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
12 Oct 2009 at 19:45 UTC
Updated:
23 May 2017 at 11:16 UTC
Jump to comment: Most recent
Comments
Comment #1
manuel garcia commentedThis not something that the module does, sorry. I would not use it for a table of contents, perhaps you should implement that as a menu, and use dhtml_menu for this? As far as I can remember it does retain the status of the menu through a cookie, though I haven't used it in a while.
Unless someone provides a clean patch to get this done, I don't see the feature happening sorry, nor do I think it's necessary for the use case of an accordion, so for now I'm setting the status to won't fix. If someone wants to work on this feature, feel free to submit a patch of course.
P.S. Feature requests are made against the development version of modules ;)
Comment #2
tommyk commentedHere's a use case where maintaining the state would be very useful:
A link to a PDF file is contained in the expanded content. A user clicks on the PDF and it opens in the same window/tab. The user clicks the back button to the page with the accordion on it and loses where they were.
I don't know how to implement a cookie to remember the state, but I just wanted to say that this feature could be very useful.
If I can learn how or find someone to help, I'll get this contributed.
Comment #3
surgeonbor commentedI just ran into the same issue. You can use a preprocess function to programmatically set which accordion is expanded, and thereby maintain the state. Make a custom template for views-view-accordion.tpl.php (e.g. views-view-accordion--name-of-view.tpl.php), and in its preprocess function change the values of the style plugin variables.
Comment #4
manuel garcia commentedYou can already choose which row starts opened when the accordion loads through the views UI surgeonbor, this thread is about something else.
Comment #5
surgeonbor commentedI understand that, but in the preprocess function you can programmatically determine which one opens first. Instead of simply writing
you can do some logic based on whatever variables are available and set $row appropriately. In my case, I set $row based on the node type indicated by the value of arg(1), and therefore maintain the expanded/collapsed state. This can't be accomplished in the Views UI.
Comment #6
manuel garcia commentedThat's stil outside of the scope of this issue, this issue is about maintaining the opened item that the user last opened when they clicked to go to another page.
What you talk about might be useful in some cases, and that's why we used a preprocess function, but this issue is about something else.
Comment #7
RAWDESK commented@surgeonbor You don't explicitly need to override the tpl file to have the theme hook triggered.
function yourtheme_preprocess_views_view_accordion(&$vars) {}will do the trick also.