View filter doesn't work

Created on 17 January 2021, almost 4 years ago
Updated 1 August 2024, 5 months ago

Problem/Motivation

I may be using the filter wrong but through my tests I fell on two separate issues ;

  • Selecting a term through a select list :
    • Works properly in the view query, the machine name is properly set as a query condition.
    • Once the filter is saved, the option display "Unknown" as the selected value.
    • The view can't be saved as an error prevent this to happen : "No valid values found on filter: @filter." coming from InOperator:validate().
  • Selecting a term through an autocomplete field:
    • The condition is not properly set as it's still a tid that is set.
    • Fatal error when trying to save the view.

Steps to reproduce

  1. Enable the module and create a bunch of test taxonomy terms.
  2. Create a taxonomy term view.
  3. Add a machine name filtering field.
  4. Save the view.

Proposed resolution

From what I see the adminSummary() method tries to load a term based on its id, where it should now try to load it through its machine name properties.
The whole logic behind the autocomplete field seems to be broken as an autocomplete field will always return a tid (based on what the core returns). I'm not sure this type of field should be kept at all to select the terms.

Remaining tasks

Decide what to do with the autocomplete selection mode.
Once the proposed patch is applied there is still an error when trying to save the view. To fix this this patch is required: https://www.drupal.org/project/drupal/issues/2925890 🐛 Invalid config structures can result in exceptions when saving a config entity Needs work

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Needs review

Version

1.0

Component

Taxonomy

Created by

🇫🇷France nicoloye

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

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024