I am using Views Exposed Filters and created an issue with them http://drupal.org/node/1974108

But I am not sure if its there problem of Views Dependent Filters problem, I am starting to think its VDF's issue. If the filters are placed in fieldsets (which is what VIews Exposed Filters does), the VDF doesn't work.

Comments

TravisJohnston’s picture

Anything?

vivdrupal’s picture

Issue summary: View changes

Am also interested in making this work in fieldsets.

aczietlow’s picture

Look at overriding the views-exposed-form.tpl.php. In that template file you can create a custom fieldset and but the exposed filters inside of it.

Code snippet from views-exposed-form.tpl.php

<div class="views-exposed-widgets clearfix">
    <fieldset class="<?php print $collapsed; ?> collapsible">
      <legend><span class="fieldset-legend">Advanced Search</span></legend>
      <div class="fieldset-wrapper">
        <div class="fieldset-description">field set description</div>
          <?php if (!empty($widgets['filter-type'])): ?>
            <?php if (!empty($widgets['filter-type']->label)): ?>
              <label for="<?php print $widgets['filter-type']->id; ?>" class="label">
                <?php print $widgets['filter-type']->label; ?>
              </label>
            <?php endif; ?>
            <?php print $widgets['filter-type']->widget; ?>
          <?php endif; ?>


          <?php $widget = $widgets['filter-exposed-form-name']; ?>
          <div id="<?php print $widget->id; ?>-wrapper" class="views-exposed-widget views-widget-<?php print $id; ?>">
            <?php if (!empty($widget->label)): ?>
              <label for="<?php print $widget->id; ?>" class="label">
                <?php print $widget->label; ?>
              </label>
            <?php endif; ?>
            <?php print $widget->widget; ?>
          </div>


        
          <?php $widget = $widgets['filter-exposed-form-name2']; ?>
          <div id="<?php print $widget->id; ?>-wrapper" class="views-exposed-widget views-widget-<?php print $id; ?>">
            <?php if (!empty($widget->label)): ?>
              <label for="<?php print $widget->id; ?>" class="label">
                <?php print $widget->label; ?>
              </label>
            <?php endif; ?>
            <?php print $widget->widget; ?>
          </div>
      </div>


    </fieldset>
  </div>

I wanted the fieldset to be collapsed when the exposed filters had values selected. To accomplish this I'd put the logic in template.php of my them.

function theme_preprocess_views_exposed_form(&$vars) {
  drupal_add_js('misc/form.js');
  drupal_add_js('misc/collapse.js');

  $vars['collapsed'] = 'collapsed';

  // The exposed forms that belong in the advanced search fieldset.
  $forms = array(
    $vars['form']['type'],
    $vars['form']['name_of_exposed_filter_form1'],
    $vars['form']['name_of_exposed_filter_form2'],
  );

  array_walk($forms, function($exposed_form) use (&$vars) {
    // If an exposed form has anything other than a default value selected
    // then the advanced search fieldset should be expanded.
    if ($exposed_form['#default_value'] != $exposed_form['#value']) {
      $vars['collapsed'] = 'collapse-processed';
    }
  });
}

I'm sure there are other way of accomplishing this, but this worked well for me.

generalredneck’s picture

Version: 7.x-1.1 » 7.x-1.x-dev

Drupal 7 is no longer supported, closing. If this is a bug/feature for the latest version of the module, please reopen and change the version.

generalredneck’s picture

Status: Active » Closed (outdated)

Drupal 7 is no longer supported, closing. If this is a bug/feature for the latest version of the module, please reopen and change the version.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.