Skip to content

Don’t abort queries that allow null custom field value#17084

Merged
brandonkelly merged 3 commits into5.7from
feature/cms-1390-dont-abort-queries-that-allow-null-custom-field-value
Apr 14, 2025
Merged

Don’t abort queries that allow null custom field value#17084
brandonkelly merged 3 commits into5.7from
feature/cms-1390-dont-abort-queries-that-allow-null-custom-field-value

Conversation

@brandonkelly
Copy link
Copy Markdown
Member

Description

As of Craft 5.6 (1459e6d), element queries which include any unresolvable custom field params are aborted so they return no results.

This change makes it possible to sidestep that behavior, by setting the param value to an array which includes null as one of the possible values.

{% set entries = craft.entries()
  .section('sectionWithoutDropdownField')
  .myDropdownField(['red', null])
  .all() %}

{% set entries = craft.entries()
  .section('sectionWithoutDropdownField')
  .myDropdownField({
    value: ['red', null],
    caseInsensitive: true,
  })
  .all() %}

Related issues

@linear
Copy link
Copy Markdown

linear Bot commented Apr 14, 2025

@brandonkelly brandonkelly merged commit 1bb18c8 into 5.7 Apr 14, 2025
@brandonkelly brandonkelly deleted the feature/cms-1390-dont-abort-queries-that-allow-null-custom-field-value branch April 14, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant