Views EntityReference filter opt-in breaks Views filter config UI for non-exposed filters

Created on 26 June 2025, 1 day ago

Problem/Motivation

After enabling the new core Views EntityReference filter, the configuration UI for entity reference filters appears to be broken for non-exposed filters. Originally reported to views_core_entity_reference β†’ .

Steps to reproduce

  1. Install Drupal 10.4.8.
  2. Install views_core_entity_reference 1.0.0-alpha3 and enable. (Alternatively, follow these instructions ✨ Continuation Add Views EntityReference filter to be available for all entity reference fields Active to enable the filter on select fields.)
  3. Add a test field to default Page content type to reference Article content (unlimited, not required).
  4. Create sample Articles and sample Pages, which reference those Articles.
  5. Create a view of Pages using default options.
  6. Add a filter criteria to the view.
  7. Select the test field created in step 3.
  8. Select "Content type" of Article.
  9. Select "Selection type" of Autocomplete.
  10. Leave operator as "is one of."
  11. In the Autocomplete field, type a character and select a result.
  12. Click Apply.
  13. An AJAX error will appear in the JS console and modal form will not close as expected. Web server error logs show this error:

    Uncaught PHP Exception TypeError: "Illegal offset type in isset or empty" at /app/web/core/modules/views/src/Plugin/views/filter/InOperator.php line 345, referer: https://d10.lndo.site/admin/structure/views/view/test1
  14. Additionally, if you change "Selection type" to Select List, after choosing an option and clicking Apply, the form does not close as expected and the web server will log this error:

    Uncaught PHP Exception InvalidArgumentException: "The configuration property display.default.display_options.filters.field_articles_target_id.value.0.target_id doesn't exist." at /app/web/core/lib/Drupal/Core/Config/Schema/ArrayElement.php line 95, referer: https://d10.lndo.site/admin/structure/views/view/test1
  15. The view is now broken and can't be edited. Clearing the tempstore for the view will let you back in:

    drush php:eval "\Drupal::keyValueExpirable('tempstore.shared.views')->delete('test1');"

Proposed resolution

Unknown. Debugging this some, in InOperator::adminSummary it looks like $this->value is an array of arrays when the code expects just an array. So the foreach ends up with $value as an array, and calling isset($flat_options[$value]) gives us the illegal offset error. I'm not sure though where this can be addressed - maybe further up the inheritance chain in EntityReference class?

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

10.4 ✨

Component

views_ui.module

Created by

πŸ‡ΊπŸ‡ΈUnited States msielski

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

Comments & Activities

Production build 0.71.5 2024