Skip to content

[6.x] Pass field prefix to custom conditions - #15044

Merged
jasonvarga merged 1 commit into
6.xfrom
fix-8439
Jul 21, 2026
Merged

[6.x] Pass field prefix to custom conditions#15044
jasonvarga merged 1 commit into
6.xfrom
fix-8439

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Jul 21, 2026

Copy link
Copy Markdown
Member

This pull request fixes an issue where custom field conditions had no way of knowing which prefixed instance of an imported fieldset they were being evaluated for.

When a fieldset containing a custom condition is imported into a blueprint multiple times with different prefixes, the condition function receives the same values payload for every instance, making it impossible to scope the condition to the fields of the relevant fieldset instance.

This PR fixes it by passing the field's prefix into the custom condition payload, allowing conditions to be scoped dynamically:

Statamic.$conditions.add('shouldShow', ({ prefix, values }) => {
    return values[`${prefix ?? ''}my_field`] === 'something';
});

Fixes #8439

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit ef47138 into 6.x Jul 21, 2026
24 checks passed
@jasonvarga
jasonvarga deleted the fix-8439 branch July 21, 2026 18:42
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.

Custom conditions missing prefix on linked fields

2 participants