diff --git a/core/modules/views/src/Form/ViewsExposedForm.php b/core/modules/views/src/Form/ViewsExposedForm.php index 04f854d..a3bcd1c 100644 --- a/core/modules/views/src/Form/ViewsExposedForm.php +++ b/core/modules/views/src/Form/ViewsExposedForm.php @@ -11,7 +11,9 @@ use Drupal\Component\Utility\String; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Url; use Drupal\views\ExposedFormCache; +use Drupal\views\Plugin\views\display\DisplayRouterInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -115,7 +117,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#id' => drupal_html_id('edit-submit-' . $view->storage->id()), ); - $form['#action'] = $view->getUrl()->toString(); + $form['#action'] = $view->display_handler instanceof DisplayRouterInterface ? $view->getUrl()->toString() : Url::fromRoute(''); $form['#theme'] = $view->buildThemeFunctions('views_exposed_form'); $form['#id'] = Html::cleanCssIdentifier('views_exposed_form-' . String::checkPlain($view->storage->id()) . '-' . String::checkPlain($display['id'])); diff --git a/core/modules/views/src/Tests/Handler/FilterEqualityTest.php b/core/modules/views/src/Tests/Handler/FilterEqualityTest.php index fb9300d..947861f 100644 --- a/core/modules/views/src/Tests/Handler/FilterEqualityTest.php +++ b/core/modules/views/src/Tests/Handler/FilterEqualityTest.php @@ -71,6 +71,8 @@ public function testEqualGroupedExposed() { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); $view->newDisplay('page', 'Page', 'page_1'); + $view->save(); + $view->destroy(); // Filter: Name, Operator: =, Value: Ringo $filters['name']['group_info']['default_group'] = 1; @@ -124,6 +126,8 @@ public function testEqualGroupedNotExposed() { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); $view->newDisplay('page', 'Page', 'page_1'); + $view->save(); + $view->destroy(); // Filter: Name, Operator: !=, Value: Ringo $filters['name']['group_info']['default_group'] = 2; diff --git a/core/modules/views/src/Tests/Handler/FilterNumericTest.php b/core/modules/views/src/Tests/Handler/FilterNumericTest.php index 9277da5..2ea154a 100644 --- a/core/modules/views/src/Tests/Handler/FilterNumericTest.php +++ b/core/modules/views/src/Tests/Handler/FilterNumericTest.php @@ -75,6 +75,8 @@ public function testFilterNumericExposedGroupedSimple() { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); $view->newDisplay('page', 'Page', 'page_1'); + $view->save(); + $view->destroy(); // Filter: Age, Operator: =, Value: 28 $filters['age']['group_info']['default_group'] = 1; @@ -168,6 +170,8 @@ public function testFilterNumericExposedGroupedBetween() { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); $view->newDisplay('page', 'Page', 'page_1'); + $view->save(); + $view->destroy(); // Filter: Age, Operator: between, Value: 26 and 29 $filters['age']['group_info']['default_group'] = 2; @@ -196,6 +200,8 @@ public function testFilterNumericExposedGroupedNotBetween() { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); $view->newDisplay('page', 'Page', 'page_1'); + $view->save(); + $view->destroy(); // Filter: Age, Operator: between, Value: 26 and 29 $filters['age']['group_info']['default_group'] = 3; @@ -284,6 +290,8 @@ public function testFilterNumericExposedGroupedEmpty() { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); $view->newDisplay('page', 'Page', 'page_1'); + $view->save(); + $view->destroy(); // Filter: Age, Operator: empty, Value: $filters['age']['group_info']['default_group'] = 4; @@ -300,6 +308,8 @@ public function testFilterNumericExposedGroupedNotEmpty() { $filters = $this->getGroupedExposedFilters(); $view = Views::getView('test_view'); $view->newDisplay('page', 'Page', 'page_1'); + $view->save(); + $view->destroy(); // Filter: Age, Operator: empty, Value: $filters['age']['group_info']['default_group'] = 5;