Option "All" doesn't work for links

Created on 18 August 2019, over 5 years ago
Updated 11 April 2024, 11 months ago

Option "all" for taxonomy reference filter doesn't work, if "links" are selected as the disaplay method.

Steps to reproduce:

-Have a taxonomy and a CT with reference to that taxonomy
- Create a view with an exposed filter for that taxonomy
- Select "links" as display method in the exposed filter options.

If one then selects a catagory via a link, ID of the filter and ID of the selected taxonomy is added to the URL to filter the results. If one tries to click back via the "all" link, "All" is added instead of the taxonomy term ID and the view result is empty.

Any ideas?
Thanks

🐛 Bug report
Status

Active

Version

7.0

Component

Code

Created by

🇨🇿Czech Republic honyik

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸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
  • 🇺🇸United States smustgrave

    For #10

  • Status changed to Needs work 9 months ago
  • 🇧🇪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.
  • mdranove changed the visibility of the branch 7.0.x to hidden.

  • Merge request !128Draft: Links display "any" link missing → (Closed) created by mdranove
  • 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.

  • Pipeline finished with Failed
    3 months ago
    Total: 338s
    #350025
  • Pipeline finished with Failed
    3 months ago
    Total: 315s
    #350028
  • Pipeline finished with Failed
    2 months ago
    Total: 222s
    #364771
  • Pipeline finished with Failed
    2 months ago
    Total: 222s
    #364778
  • Pipeline finished with Failed
    2 months ago
    Total: 279s
    #364800
  • 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.

  • Merge request !131Fix Links Display Widget Select All → (Open) created by mdranove
  • Pipeline finished with Failed
    2 months ago
    Total: 270s
    #365817
  • Pipeline finished with Success
    2 months ago
    Total: 291s
    #365928
  • 🇺🇸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."

  • Pipeline finished with Failed
    2 months ago
    Total: 385s
    #373209
  • Pipeline finished with Success
    2 months ago
    Total: 320s
    #373226
  • Used twig to render link. Moving back to NR.

  • 🇺🇸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.

  • Pipeline finished with Success
    2 months ago
    Total: 232s
    #374281
  • Pipeline finished with Success
    2 months ago
    Total: 253s
    #375069
  • Pipeline finished with Failed
    2 months ago
    Total: 228s
    #375088
  • Pipeline finished with Failed
    2 months ago
    Total: 229s
    #375094
  • 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.

Production build 0.71.5 2024