Enabling module triggers a separate core bug related to views filters

Created on 8 September 2025, 28 days ago

Problem/Motivation

Use of this module led to an error with views related to 3294700 πŸ› Warning: Undefined array key "type" in Drupal\views\Plugin\views\filter\Date->acceptExposedInput() Needs work .

Steps to reproduce

It requires having a view that uses an entity reference field as a filter with a fixed ID entered as "equals". In my instance, we had a homepage news view that used a group ID to ensure only items added to the home group would appear in that block. After enabling views_core_entity_reference, the = filter changed to a mutliselect with an in operator breaking the block view and causing a configuration mismatch. (And unfortunately, it wasn't caught with our automated tests and made it to production.)

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

None

API changes

TBD

Data model changes

TBD

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States joshuami Portland, OR

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

Comments & Activities

  • Issue created by @joshuami
  • πŸ‡ΊπŸ‡ΈUnited States joshuami Portland, OR

    Oh interesting. I had not looked very closely at the code of this module before using it.

    foreach ($field_configs as $field_config) {
        $table_name = $field_config->getTargetEntityTypeId() . '__' . $field_config->getName();
        $column_name = $field_config->getName() . '_target_id';
        if (
          isset($data[$table_name][$column_name]['filter']['id'])
          && in_array($data[$table_name][$column_name]['filter']['id'], ['numeric', 'string'])
        ) {
          $data[$table_name][$column_name]['filter']['id'] = 'entity_reference';
        }
      }
    

    That changes the filter from a numeric string to a entity reference for all instances within views, but that's sort of a mismatch for any existing view. I'm not really sure this could be done in a way that doesn't break backwards compatibility unless enabling the module recursively updated every view with an existing entity reference filter.

Production build 0.71.5 2024