Skip to content

strict mode for Lightswitch field params#17083

Merged
brandonkelly merged 2 commits into5.7from
feature/cms-1389-strict-mode-for-lightswitch-field-params
Apr 14, 2025
Merged

strict mode for Lightswitch field params#17083
brandonkelly merged 2 commits into5.7from
feature/cms-1389-strict-mode-for-lightswitch-field-params

Conversation

@brandonkelly
Copy link
Copy Markdown
Member

Description

Lightswitch fields’ element query params now support passing in an array with value and strict keys.

{% set entries = craft.entries()
  .section('news')
  .myLightswitchField({value: false, strict: true})
  .all() %}

If strict is true, elements without a value for the field will be omitted from the results, rather than treated as having the default value selected.

Related issues

@linear
Copy link
Copy Markdown

linear Bot commented Apr 14, 2025

[ci skip]
@brandonkelly brandonkelly merged commit 4fc66cb into 5.7 Apr 14, 2025
@brandonkelly brandonkelly deleted the feature/cms-1389-strict-mode-for-lightswitch-field-params branch April 14, 2025 16:57
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