You are here

public function views_plugin_exposed_form::reset_form in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 plugins/views_plugin_exposed_form.inc \views_plugin_exposed_form::reset_form()
1 call to views_plugin_exposed_form::reset_form()
views_plugin_exposed_form::exposed_form_submit in plugins/views_plugin_exposed_form.inc
This function is executed when exposed form is submited.

File

plugins/views_plugin_exposed_form.inc, line 340
Definition of views_plugin_exposed_form.

Class

views_plugin_exposed_form
The base plugin to handle exposed filter forms.

Code

public function reset_form(&$form, &$form_state) {

  // _SESSION is not defined for users who are not logged in.
  // If filters are not overridden, store the 'remember' settings on the
  // default display. If they are, store them on this display. This way,
  // multiple displays in the same view can share the same filters and
  // remember settings.
  $display_id = $this->view->display_handler
    ->is_defaulted('filters') ? 'default' : $this->view->current_display;
  if (isset($_SESSION['views'][$this->view->name][$display_id])) {
    unset($_SESSION['views'][$this->view->name][$display_id]);
  }

  // Set the form to allow redirect.
  if (empty($this->view->live_preview)) {
    $form_state['no_redirect'] = FALSE;
  }
  else {
    $form_state['rebuild'] = TRUE;
    $this->view->exposed_data = array();
  }
  $form_state['redirect'] = current_path();
  $form_state['values'] = array();
}