cms
cms copied to clipboard
[5.x] Add `includes` and `doesnt_include` conditions and modifiers
This is a second go at this and is an alternative to / replaces https://github.com/statamic/cms/pull/8357
This PR adds an includes
modifier and tag condition, as well as a doesnt_include
tag condition. The Modifier is intentionally a loose comparison, so if any of the values in needle are found it counts as a match. This is to mirror how whereJsonContains()
on the eloquent side.
Potentially an includes_all
modifier could be added for a strict comparison (or the naming of this could be changed to includes_any
).
Closes https://github.com/statamic/ideas/issues/910
Good job! This is very useful and will solve not being able to filter by any field that gets saved by an array (like multiple select, checkboxes etc).
This is very useful, and seems to work like a charm. I ran into a Statamic limitation and @afonic pointed me to your PR Ryan. Thanks both.
Jason do you reckon this will make the cut someday and I can patch it in? Otherwise I'll work on a query scope instead.
do you reckon this will make the cut someday
More than likely, but not 100% sure.
Gotcha. Thanks Jason.
Nice! This will close https://github.com/statamic/ideas/issues/910