ideas
ideas copied to clipboard
Make it possible to use `without target` conditions with others
I ran into a situation where I need to use multiple field conditions including one custom condition without target. Currently, you can only either set multiple conditions with a target OR one condition without target. You can't mix and match.
This is my field:
[
'handle' => 'seo_section_sitemap',
'field' => [
'type' => 'section',
'if' => [
'showSitemapFields',
'seo_noindex.value' => 'false',
'seo_canonical_type.value' => 'equals current',
],
],
],
As a workaround, you could do the following, no?
[
'handle' => 'seo_section_sitemap',
'field' => [
'type' => 'section',
'if' => [
'showSitemapFields' => 'custom showSiteMapFields',
'seo_noindex.value' => 'false',
'seo_canonical_type.value' => 'equals current',
],
],
]
The condition handler doesn't care that the field doesn't actually exist, and the data passed to the function is the same, except that target is null (but it's not used anyway).
This works, thanks! My suggestion would only be syntactic sugar then.