Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is there a way to default to expanding the exposed filter form using CSS? The theme I use allows a local.css, so that could be an easy way to handle this, if it is possible.
Alternatively, is there another relatively easy way to default to expanded filter forms in this version?
Thanks.
Comments
Comment #1
mikeker CreditAttribution: mikeker commentedApologies for the delayed reply...
Which filters are you referring to? Are these secondary options filter? If so, you can add a hook_form_alter() to a custom module to set the #collapsed state to false. See the Form API docs for more info.
Comment #2
jsibley CreditAttribution: jsibley commentedI'm not sure I understand the question about which filters I'm referring to.
The entire fieldset is defaulting to collapsed. This may be because the website is using the Drupal Commons distribution, but whether or not it is standard Drupal behavior, it would be great to have a way to set a fieldset to expanded without having to create a module.
Is this clearer?
Comment #3
mikeker CreditAttribution: mikeker commentedUnfortunately, not; I don't have a Drupal Commons distribution available to me. Can you attach an export of the view in question (ideally one simplified to reproduce this issue)? There are a lot of modules that can affect how a given exposed form renders -- nailing down which one is causing the issue can be tricky.
Thanks.
Comment #4
jsibley CreditAttribution: jsibley commentedSorry. The version of Commons I am using, is based on Drupal 6. I haven't moved to the newer version based on Drupal 7, in which this may not be an issue.
Apparently, it is not considered good coding practice, but they made the exposed filters collapsed by default in the templates they included. For example, here is the views-exposed-form.tpl.php:
It's not ideal, but I just changed this file so that it says:
instead of
This may be rare enough so that it's not worth dealing with in your module, but I had wondered whether you could override the value of "collapsed" or "expanded" through your module, which sounds like a cleaner way of making such a change.
Thanks.
Comment #5
mikeker CreditAttribution: mikeker commentedSorry, I never saw the update on this issue since it remained "postponed - maintainer needs more info."
I'm closing this since the 6.x branch is security fixes only at this point.