From a48aa76c43f9867ad6076afa7c63ff76a848af77 Mon Sep 17 00:00:00 2001 From: webchick Date: Mon, 29 Dec 2014 12:08:05 -0800 Subject: [PATCH] Issue #2370313 by olli: D8 - Exposed filter - "This webpage has a redirect loop" on Reset --- .../src/Plugin/views/exposed_form/ExposedFormPluginBase.php | 3 +++ core/modules/views/src/Tests/Plugin/ExposedFormTest.php | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php index cf21590a50..3652e8be28 100644 --- a/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php +++ b/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php @@ -327,6 +327,9 @@ public function resetForm(&$form, FormStateInterface $form_state) { $form_state->setRebuild(); $this->view->exposed_data = array(); } + + $form_state->setRedirect(''); + $form_state->setValues([]); } } diff --git a/core/modules/views/src/Tests/Plugin/ExposedFormTest.php b/core/modules/views/src/Tests/Plugin/ExposedFormTest.php index 1fa0c19d28..c6bc33556d 100644 --- a/core/modules/views/src/Tests/Plugin/ExposedFormTest.php +++ b/core/modules/views/src/Tests/Plugin/ExposedFormTest.php @@ -101,6 +101,11 @@ public function testResetButton() { // Test the button is hidden after reset. $this->assertNoField('edit-reset'); + // Test the reset works with type set. + $this->drupalGet('test_exposed_form_buttons', array('query' => array('type' => 'article', 'op' => 'Reset'))); + $this->assertResponse(200); + $this->assertFieldById('edit-type', 'All', 'Article type filter has been reset.'); + // Rename the label of the reset button. $view = Views::getView('test_exposed_form_buttons'); $view->setDisplay(); -- GitLab