acf-builder icon indicating copy to clipboard operation
acf-builder copied to clipboard

Feature Request: more flexible condition builder

Open chrisRidgers opened this issue 6 years ago • 0 comments

I've been playing around with Stout and one thing I've noticed is that the condition builder only supports specific field types:

... but only based on a field that has choices: checkbox, radio, select, true_false.

(From the wiki)

In ACF its not uncommon to add in conditional logic based on whether or not a a field is set. I believe I've replicated this in Stout using the following:

<?php

...

            ->addSelect('sub-heading_color', [
                'conditional_logic' => [
                    [
                        [
                            'field' => 'sub-heading',
                            'operator' => '!=empty'
                        ]
                    ]
                ],
...

And visually in the admin system that does what I'm expecting, when the other field sub-heading has an empty value input the sub-heading_color field is not displayed.

Can conditions be adapted to support such behaviour? For example:

<?php
...

    ->addSelect('sub-heading_color')
    ->conditional('sub-heading', '!=empty')
...

chrisRidgers avatar Sep 09 '19 08:09 chrisRidgers