Skip to content

[6.x] Support for multiple conditions with the same target field - #14593

Merged
jasonvarga merged 2 commits into
statamic:6.xfrom
godismyjudge95:multiple-conditions-per-target-field
Sep 1, 2026
Merged

[6.x] Support for multiple conditions with the same target field#14593
jasonvarga merged 2 commits into
statamic:6.xfrom
godismyjudge95:multiple-conditions-per-target-field

Conversation

@godismyjudge95

Copy link
Copy Markdown
Contributor

This came up in the Statamic Office Hours, and it's something I've personally run into a number of times.

Currently when you want to reveal based on a field being A or B or C. You must create a custom condition because Statamic doesn't support using the same field for multiple conditions. This PR fixes that.

It is completely backwards compatible and simply wraps the right hand side of the condition in an array if there are multiple conditions for the same target field.

This outputs this for multiple conditions:

if:
  age:
    - '> 18'
    - '< 65'

And this for a single condition:

if:
  age: '> 18'

Any previous blueprints with only a single condition will continue to work and if a new condition is added to them it will convert it to the array/list syntax.

Resolves:

@jasonvarga
jasonvarga merged commit ce294ee into statamic:6.x Sep 1, 2026
61 checks passed
@godismyjudge95
godismyjudge95 deleted the multiple-conditions-per-target-field branch September 1, 2026 19:59
duncanmcclean added a commit that referenced this pull request Sep 2, 2026
merging 6.x into forms-2 kept the rewritten `Condition.vue` wholesale, which
dropped the change from #14593 that stopped excluding fields already used in
another condition. the exclusion lived in the shared `Condition` component, so
it blocked field conditions, form field logic and page rules alike.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Sy7LsNJGjpwE2ZNr8BphpQ
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.

2 participants