Generate and use Field Partials
masterField partials are reusable field groups that can be injected into other field groups.
- Generate a partial:
wp acorn acf:partial {Name}. This creates a class extendingPartialinsrc/Fields/Partials/. - Implementation: Unlike standard fields, a
Partialclass should not call->build()in itsfields()method; it should return theFieldsBuilderinstance itself. - Usage: In a parent
Fieldclass, use the->addPartial()method and pass the partial's class constant.
// In a Field class
public function fields()
{
$fields = Builder::make('example');
$fields
->addPartial(ListItems::class);
return $fields->build();
}