Skip to content

Modify / Remove Nested Fields

Latest
Compare
Choose a tag to compare
@stevep stevep released this 17 Sep 18:12
· 10 commits to master since this release

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