diff --git a/src/Form/CheckboxWidgetForm.php b/src/Form/CheckboxWidgetForm.php index 779052c..827d645 100644 --- a/src/Form/CheckboxWidgetForm.php +++ b/src/Form/CheckboxWidgetForm.php @@ -130,10 +130,11 @@ class CheckboxWidgetForm implements BaseFormIdInterface { // symfony class that requires a full URL. if (count($active_results) > 0) { $arguments = []; + $filter_key = $facet->getFacetSourceConfig()->getFilterKey(); /** @var \Drupal\facets\Result\ResultInterface $link */ foreach ($active_results as $k => $link) { - $arguments[] = 'f[' . $k . ']=' . $facet->getUrlAlias() . ':' . $link->getRawValue(); + $arguments[] = $filter_key . '[' . $k . ']=' . $facet->getUrlAlias() . ':' . $link->getRawValue(); } $url = $base_request_uri . '?' . implode('&', $arguments); diff --git a/src/Tests/WidgetIntegrationTest.php b/src/Tests/WidgetIntegrationTest.php index 103a598..c599039 100644 --- a/src/Tests/WidgetIntegrationTest.php +++ b/src/Tests/WidgetIntegrationTest.php @@ -144,6 +144,17 @@ class WidgetIntegrationTest extends WebTestBase { } /** + * Tests submitting multiple items at the same time. + * + * This uses a configured facet source url. + */ + public function testMultipleCheckboxItems2() { + $this->drupalGet('admin/config/search/facets/facet-sources/search_api_views:search_api_test_view:page_1/edit'); + $this->drupalPostForm(NULL, ['filter_key' => 'q'], $this->t('Save')); + $this->testMultipleCheckboxItems(); + } + + /** * Tests multiple checkbox widgets. */ public function testMultipleCheckboxWidget() {