- 🇺🇸United States smustgrave
Sounds like the bug is that the select "All" option appears when selecting links. Am I mistaken in that?
- Status changed to Postponed: needs info
9 months ago 4:07pm 22 May 2024 - Status changed to Needs work
9 months ago 10:55am 3 June 2024 - 🇧🇪Belgium ant1
#10: If multiple selections are allowed, the "Add select all/none links" checkbox does not for the Links widget.
It does show for you disable multiple selections. - First commit to issue fork.
Created draft !128 which fixes this.
Basically the problem is that there is an explicit logic check in core Views' FilterPluginBase.php preventing the "Any" link from being passed to the "options" array if the "multiple values" selection is made.
It looks like this
if ($type == 'value' && empty($this->always_required) && empty($this->options['expose']['required']) && $form['#type'] == 'select' && empty($form['#multiple'])) { $form['#options'] = ['All' => $this->t('- Any -')] + $form['#options']; $form['#default_value'] = 'All'; }
There is some nice code to workaround this for radios currently. What I have so far is pretty bare bones but gets the job done if you're just looking to get that link in the array out of the box.
This is going to need a rework of LinksFilterWidgetKernelTest.php as the test is not functioning correctly.
Currently, the test believes the "select all none" checkbox is checked for BEF links filter config by default and is looking for the "Any" link at the top of the list, even though in the test this is not specified and currently as discussed above the checkbox does not function correctly.
Maybe need to move this to a JS test.
- 🇺🇸United States smustgrave
So when I add the bef_location field to the test view and apply the MR
I do see the -Any- option
But when I try it I get "The submitted value All in the bef_location (field_bef_location) element is not allowed." - 🇺🇸United States smustgrave
lets add a test though for the issue I saw in #21. Making sure when you click a link it filters and when you click 'All' it get all options
Left a comment on the MR.
Should be good now, but I cant seem to get the test I added to the last commit to pass, although it looks fine to me.