I am just learning how to use ACFComposer and can’t figure out how to add some sub_field to a FlexibleContent field. I want to eventually use field partials but would like to start with adding fields directly in addLayout. I’m not finding any example code from ACFComposer, ACFBuilder or from Log1x’s awesome cheatsheet. that actually shows what goes in 'sub_fields' => []
I’m a bit lost.
Any sample code or direction would be appreciated, thank you,
<?php
namespace App\Fields;
use Log1x\AcfComposer\Field;
use StoutLogic\AcfBuilder\FieldsBuilder;
use App\Fields\Partials\ListItems;
class Examples extends Field
{
/**
* The field group.
*
* @return array
*/
public function fields()
{
$example = new FieldsBuilder('example');
$example
->setLocation('page_template', '==', 'template-development-flexible-content.blade.php');
$example
->addFlexibleContent('flexible_content_field', [
'instructions' => '',
'required' => 0,
'conditional_logic' => [],
'wrapper' => [
'width' => '',
'class' => '',
'id' => '',
],
'button_label' => 'Add Row',
'min' => '',
'max' => '',
])
->addLayout('layout', [
'label' => 'Layout',
'display' => 'block',
'sub_fields' => [],
'min' => '',
'max' => '',
]);
return $example->build();
}
}