You are here

Panels and exposed filters (the repeating URL)

When using panels together with views panes, which have exposed filters, it happens that parts of the URI is append in the URI each time you submit the form. This can be fixed by altering the views exposed form action variable.

The form name in the code below can be found in the HTML or by using the view name + display id with an underscore in the middle.

function MODULE_NAME_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#id'] == 'FORM_NAME') {
    // Change the form action to reflect the panel's path
    $form['#action'] = request_uri();
  }
}

This code also applies to Drupal 6 by simply remove the last parameter ($form_id) from the function.

Tags

Drupal views panels PHP

Add new comment