acf-builder
acf-builder copied to clipboard
New conditionals with only two parameters.
@stevep,
ACF 5.7 brings with it new field conditionals that only have two parameters.
Unfortunately, ACF Builder doesn't allow conditions with two parameters.
I've tried passing null but while it successfully builds, it stops the validation from working properly in certain scenarios.
Unfortunately this is causing a breaking issue for me.
The two conditionals in question are "==empty" and "!=empty".
Here's an example of how the fields output through the generate PHP option in ACF.
'conditional_logic' => array(
array(
array(
'field' => 'field_5b1305029be7d',
'operator' => '>',
'value' => '6.4999999',
),
array(
'field' => 'field_5b1305029be7d',
'operator' => '<',
'value' => '8.5000000',
),
array(
'field' => 'field_5b1305029be7d',
'operator' => '!=empty',
),
),
),
Finally going to implement this, it seems that basically we should make the value parameter optional(?)
^ yep
Any word on this? Would like to implement this!
For anyone looking to do this, it seems to work if you set the third parameter to an empty string or false
E.g. ->conditional('field_name', '!=empty', false);