views:

295

answers:

2

hi,

DRUPAL question. I'm using Views, with an exposed filter (Taxonomy). I've downloaded the "better exposed filter" module to display it as checkbox list. a Now, how can I order the tags in the filter list ? "Views Sort" is not the solution because I only can order articles but not the filter items!!

I want to add an option (checkbox) for the customer to order the tags alphabetically or leave them in the default order.

thanks

A: 

You need to follow the example of Better Exposed Filters in form_alter'ing the exposed filters form and sorting your filter's #options array:

function mymodule_form_views_exposed_form_alter(&$form, $form_state) {
  foreach ($form_state['view']->filter as $field => $filter) {
    if ($filter->options['exposed'] /* && is my filter */) {
      $field_id = $form['#info']["filter-$field"]['value'];
      asort($form[$field_id]['#options']);
    }
  }
}
infojunkie
A: 

I've solved with jQuery.

Patrick

related questions