Conditionals referencing parent fields
You can now write conditionals that reference fields not on the same level. [Issue: #52]
You can either just reference the name of the parent field:
$builder = new \StoutLogic\AcfBuilder\FlexibleContentBuilder('sections');
$builder
->addLayout('hero')
->addSelect('hero_type')
->addChoices('fullscreen', 'standard')
->addImage( 'hero_image' )
->addWysiwyg( 'hero_text' )
->addRepeater('cta')
->addSelect('link_type')
->addChoices('internal', 'external', 'text')
->addTrueFalse('cta_animated')
->conditional('hero_type', '==', 'fullscreen');
Or you can set a custom key
$builder = new \StoutLogic\AcfBuilder\FlexibleContentBuilder('sections');
$builder
->addLayout('hero')
->addSelect('hero_type')
->addChoices('fullscreen', 'standard')
->setCustomKey('my_custom_key')
->addImage( 'hero_image' )
->addWysiwyg( 'hero_text' )
->addRepeater('cta')
->addSelect('link_type')
->addChoices('internal', 'external', 'text')
->addTrueFalse('cta_animated')
->conditional('my_custom_key', '==', 'fullscreen');
This shouldn't break backwards compatibility, I've tested it on my professional projects. But if you do run into issues, let me know ASAP.