Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Summary
If a field is excluded from display, but is included in the Combine fields filter, it does not actually get filtered. Various issues may come about, see Related issues.
Steps to reproduce
- Create a content type with a Text field
- Create a view displaying fields of that content type
- Add two fields (e.g. title & text field)
- Exclude text field from display
- Create Combine fields filter
- Expose the filter, Set it as Required
- Include both fields to be searched on
- Search for a value that is only in the excluded text field
- See that the record isn't filtered
Related issues
- In 7.x-3.11, the issue that arises is #2284593: Fatal error: Call to a member function ensure_my_table() on a non-object , which simply prevents $field->ensure_table() on non-objects.
- In 7.x-3.x-dev the issue is simply that Combine fields filter does not actually search the excluded fields.
- When testing from a Drush qd I get "SQLSTATE[HY000]: General error: 1 no such function: CONCAT_WS" because CONCAT_WS is not supported by SQLite. See #2009238: CONCAT_WS is not compatible with all database drivers and #2318191: [meta] Database tests fail on SQLite
Background
I first mentioned this issue as a comment in #2373745: Combine fields filter with missing field(s) results in fatal error: Call to a member function ensure_my_table() on a non-object, and decided to separate this as a separate issue.
Suggested solution
Include excluded field data in the search
Comments
Comment #1
rudiedirkx CreditAttribution: rudiedirkx commentedDid you actually reproduce this? Because it works fine for me.
This is the resulting query:
As you can see both
node.title
andfield_data_field_bgcolor.field_bgcolor_value
are searched. And the results back that up: 1 result with "green" as Background color.