Open alexadark opened 2 years ago
@alexadark Ah I see, ACF builder is relying on the 3rd party library to handle the automatic singular of a word for the button labels in the Flexible Content and Repeater field types. But if you don't have it installed with composer or installed manually it will fail. Probably not the best developer experience.
The good thing is, it will only attempt to do so if button_label
isn't passed in the field config. See: https://github.com/StoutLogic/acf-builder/blob/e63ab87233ea3675cd519f1dd6b6d4230b3cef97/src/FlexibleContentBuilder.php#L28-L30
So you should be able to pass it in, try:
use StoutLogic\AcfBuilder\FieldsBuilder;
$content = new FieldsBuilder('page_content');
$content
->addFlexibleContent('sections', ['button_label' => 'Add Section'])
->addLayout('banner')
->addText('title')
->addWysiwyg('content')
->addLayout('content_columns')
->addRepeater('columns', ['min' => 1, 'max' => 2])
->addWysiwyg('content');
add_action('acf/init', function() use ($content) {
acf_add_local_field_group($content->build());
});
Thanks! everything works now!
Hello, I'm trying to add flexible content, and it gives errors, even by pasting the example
This is what happens on the WordPress side Fatal error: Uncaught Error: Class 'Doctrine\Common\Inflector\Inflector' not found in /Users/alexandraspalato/Local Sites/agencytheme/app/public/wp-content/plugins/headlesswp-core/acf-builder/src/Traits/CanSingularize.php on line 18
Same thing happens with the repeater field
I'm much more a react dev, than PHP, but this is the example, so it should work... I don't use composer, so I have installed acf-builder with autoload