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?



Status:Active» Postponed (maintainer needs more info)

Apologies 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.

I'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?

Is this clearer?

Unfortunately, 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.


Sorry. 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:

// $Id: views-exposed-form.tpl.php,v 2009/11/18 20:37:58 merlinofchaos Exp $
* @file views-exposed-form.tpl.php
* This template handles the layout of the views exposed filter form.
* Variables available:
* - $widgets: An array of exposed form widgets. Each widget contains:
* - $widget->label: The visible label to print. May be optional.
* - $widget->operator: The operator for the widget. May be optional.
* - $widget->widget: The widget itself.
* - $button: The submit button for the form.
* @ingroup views_templates
// Add collapsible fieldset js if it is not already included

<?php if (!empty($q)): ?>
// This ensures that, if clean URLs are off, the 'q' is added first so that
    // it shows up first in the URL.
print $q;

<?php endif; ?>
<fieldset class="views-exposed-form collapsible collapsed">
<legend><?php print(t("Filter")); ?></legend>
  <div class="views-exposed-wrapper clear-block">
  <div class="views-exposed-widgets clear-block">
    <?php foreach($widgets as $id => $widget): ?>
      <div class="views-exposed-widget">
        <?php if (!empty($widget->label)): ?>
          <label for="<?php print $widget->id; ?>">
            <?php print $widget->label; ?>
        <?php endif; ?>
        <?php if (!empty($widget->operator)): ?>
          <div class="views-operator">
            <?php print $widget->operator; ?>
        <?php endif; ?>
        <div class="views-widget">
          <?php print $widget->widget; ?>
    <?php endforeach; ?>
    <div class="views-exposed-widget views-exposed-submit">
      <?php print $button ?>

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.


Issue summary:View changes
Status:Postponed (maintainer needs more info)» Closed (won't fix)

Sorry, 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.