NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #3135 most downloaded on Packagist
An Advanced Custom Field Configuration Builder
Latest stable
v1.12.0
Last release 5 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.2 years
Most releases are documented
notes for 16 of 21 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
21 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
I didn't want them to experience unintended consequences. When releasing a major version with breaking changes we will revisit this possibility.
A frequent requested feature was the ability to modify and remove nested fields. This is now possible with adding the getField method to the GroupBuilder and getLayout to the FlexibleContentBuilder. Also introduced is a short hand so you don't have to chain getField calls. Using the -> delimiter you can directly reach the field you're right to modify or remove.
Example:
$builder->removeField('sections->hero->sub_title');
There was discussion of using a . dot delimiter instead for the short hand, but I decided to use the arrow in case people had used a . in their existing field names. I didn't want them to experience unintended consequences. When releasing a major version with breaking changes we will revisit this possibility.
Check out the docs for it here: https://github.com/StoutLogic/acf-builder/wiki/modifying-fields#modifying-nested-fields
Thanks @Androlax2 @voyou-sbeaulieu @marcelo2605 for your contributions and patience
Merged in some PRs: #133 and #137
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Merged in some PRs: #133 and #137
Thanks @titouanmathis and @davddo
You can now write conditionals that reference fields not on the same level. [Issue: #52]
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.
Other additions include:
Add support for doctrine/inflector ^2.0 and some code cleanup, while maintaining backwards compatibility with Add support for doctrine/inflector ^1.1
Add support for doctrine/inflector ^2.0 and some code cleanup, while maintaining backwards compatibility with Add support for doctrine/inflector ^1.1 and older versions of PHP
Thanks @Log1x !
Allows you to use ->setLabel('My Custom Label') on a FieldBuilder. Thanks @Log1x and sorry for the delay.
Allows you to use ->setLabel('My Custom Label') on a FieldBuilder. Thanks @Log1x and sorry for the delay.
ACF Builder relies on "doctrine/inflector": "^1.1", "doctrine/instantiator": "^1.0"
ACF Builder relies on "doctrine/inflector": "^1.1", "doctrine/instantiator": "^1.0"
And now will allow newer 1.x versions to be installed along site ACF Builder. Thanks @guix77 !!
@aprokopenko has graciously added function calls to make setting field width, class, id and attributes much easier.
@aprokopenko has graciously added function calls to make setting field width, class, id and attributes much easier.
$builder = new FieldsBuilder('Slider')
$builder
->addText( 'slider_title' )
->setWidth( '50%' )
->setSelector( '#my-id.my-class' )
->setAttr( 'data-custom_attr', 'thisisattr' );
No more need to manually set the wrapper array as attributes to a new field.
Nothing published for this version
Nothing published for this version
Added the new ACF Accordion field. Must be using ACF 5.6.6 to use it.
Added the new ACF Accordion field. Must be using ACF 5.6.6 to use it.
It works just like Tab field but includes two additional methods setOpen() and setMultiExpand(). true or false can be passed as a parameter, true is default.
$fieldgroup = new FieldsBuilder('group');
$fieldgroup
->addAccordion('content')
->setOpen()
->addWysiwyg('content')
->addAccordion('background')
->addImage('background_image')
->addColorPicker('background_color');
Fix some potential issues with modifyField
addRange methodmodifyFieldmodifyField documentation to explicitly say the passed closure needs to return a FieldsBuilderAdd new ACF fields addLink and addGroup. A group is treated just like a repeater, but instead of an endRepeater function, there is an endGroup functio
Add new ACF fields addLink and addGroup. A group is treated just like a repeater, but instead of an endRepeater function, there is an endGroup function.
I'm releasing this before a refactor, which the code needs, because I wanted to get the functionality out there for everyone. I'm not happy with all of the inheritance, and I'm not longer happy with the confusing names FieldsBuilder vs FieldBuilder vs GroupBuilder Also I would like to use less magic methods if possible. Perhaps in a 2.0 release.
Add Google Map field function #25
Lots of internal changes, uses an array FieldBuilder objects to story field configs instead of storing field group's field config in a simple array.
Lots of internal changes, uses an array FieldBuilder objects to story field configs instead of storing field group's field config in a simple array.
getRootContext to get the top level parentContextfieldsBuilder in a RepeaterBuilder protected so sub classes can access itgetGroupConfig function to FieldsBuilderfieldExists method to FieldsBuilderaddPostLink to addPageLink on FieldsBuilderMoved tests to autoload-dev so they aren't included in production. Issue #18 Updated composer dependencies.
Moved tests to autoload-dev so they aren't included in production. Issue #18 Updated composer dependencies.
Modifying and Removing Fields Added is the ability to modify, insert and remove fields from a FieldsBuilder. See the Modifying Fields page in the wiki
Modifying and Removing Fields Added is the ability to modify, insert and remove fields from a FieldsBuilder. See the Modifying Fields page in the wiki for more information. Issue #12
Added addTimePicker and addDateTimePicker function ACF 5.3.9 added these two new fields Issue #13
Nothing published for this version
Fixes the setLocation bug. When setLocation is called on a builder, it will call it on the parent builder context if one exists.
Resolves issues #2 and #6
Fixes the setLocation bug. When setLocation is called on a builder, it will call it on the parent builder context if one exists.
To use the library without composer, simply require the included autoload.php file.
'and' and 'or' are reserved keywords in PHP. Therefore PHP gets angry when you try to use them as method names. In testing it worked fine but in the r
'and' and 'or' are reserved keywords in PHP. Therefore PHP gets angry when you try to use them as method names. In testing it worked fine but in the real world they did not. They are now allowed via __call, and are aliases for andCondition and orCondition methods.
Nothing published for this version
Nothing published for this version
One column per quarter.