? .git Index: plugins/views_plugin_exposed_form.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views/plugins/Attic/views_plugin_exposed_form.inc,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 views_plugin_exposed_form.inc --- plugins/views_plugin_exposed_form.inc 30 Nov 2009 21:54:19 -0000 1.1.2.3 +++ plugins/views_plugin_exposed_form.inc 2 Dec 2009 23:53:15 -0000 @@ -43,6 +43,13 @@ class views_plugin_exposed_form extends '#description' => t('Text to display in the submit button of the exposed form.'), '#default_value' => $this->options['submit_button'], ); + + $form['reset_button'] = array ( + '#type' => 'checkbox', + '#title' => t('Include reset button'), + '#description' => t('If checked the exposed form will provide a button to reset all the applied exposed filters'), + '#default_value' => $this->options['reset_button'], + ); } /** @@ -91,7 +98,14 @@ class views_plugin_exposed_form extends function pre_execute() { } - function exposed_form_alter(&$form, &$form_state) { } + function exposed_form_alter(&$form, &$form_state) { + if (!empty($this->options['reset_button'])) { + $form['reset'] = array( + '#value' => t('Reset'), + '#type' => 'submit', + ); + } + } function exposed_form_validate(&$form, &$form_state) { } @@ -106,5 +120,15 @@ class views_plugin_exposed_form extends * Nested array of keys to exclude of insert into * $view->exposed_raw_input */ - function exposed_form_submit(&$form, &$form_state, &$exclude) { } + function exposed_form_submit(&$form, &$form_state, &$exclude) { + if ($form_state['values']['op'] == t('Reset')) { + $this->reset_form($form, $form_state); + } + } + + function reset_form(&$form, &$form_state) { + unset($_SESSION['views'][$this->view->name][$this->view->current_display]); + $form_state = array(); + $form_state['values'] = array(); + } }