[SOLVED][Drupal Views][Drupal 7] How to place exposed filters in a fieldset

| | 1 min read

Many Drupal users have needed to know how to place exposed filters in a fieldset in their Drupal website. If you are looking for a method to do that in your Drupal installation then read on to find out more.

Here is the solution. Use the sample code below to do that

 1){
      // assume other get vars are exposed filters, so expand fieldset
      // to show applied filters
      $collapsed = FALSE;
      $class = array('collapsible');
    }
    $fieldset['element'] = array(
      '#title' => t('Filter'),
      '#collapsible' => TRUE,
      '#collapsed' => $collapsed,
      '#attributes' => array('class' => $class),
      '#children' => $vars['exposed'],
    );
    $vars['exposed'] = theme('fieldset', $fieldset);
  }
}
?>

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.