Skip to content

[6.x] Let modifiers opt into running on null - #15849

Open
o1y wants to merge 3 commits into
statamic:6.xfrom
o1y:null-aware-modifiers
Open

o1y wants to merge 3 commits into
statamic:6.xfrom
o1y:null-aware-modifiers

Conversation

@o1y

@o1y o1y commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #15832.

That issue was only a symptom.

Since #15540, empty fields skip every modifier. That is great for the ones that choked on null, but it broke the ones where null is needed:

  • to_json prints nothing
  • {{ if field | is_blank }} is false for empty fields 👀
  • bool_string needed its own fix #15782. That fix is just a hardcoded list that grows with every bug report. Also addons can't use it, and the parameter syntax ignores it (and still throws on empty fields).

This PR replaces the hard coded list with an AcceptsNull attribute on the modifier, marks bool_string, to_json and is_blank, and makes the parameter syntax skip null the same way.

This branch has not been deployed

No deployments
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.

to_json no longer serializes augmented null values

1 participant