Skip to content

Releases: StoutLogic/acf-builder

Modify / Remove Nested Fields

17 Sep 18:12
Compare
Choose a tag to compare

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

Fix PHP Stan errors, php clone functionality

13 Jul 18:55
85f506f
Compare
Choose a tag to compare

Conditionals referencing parent fields

12 Feb 17:17
06f5903
Compare
Choose a tag to compare

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:

  • #130 Fix Intelephense's Undefined method
  • Setup testing via GitHub actions for php versions 5.4 - 7.4. The version of PHP unit being used isn't supported for PHP 8.0 so it is untested. If you run into any issues in the wild, while testing on 8.0, let me know.

Add support for doctrine/inflector ^2.0

02 Jul 01:40
1fbdb58
Compare
Choose a tag to compare

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 !

Add `setLabel` helper

03 Jan 19:42
c2c9181
Compare
Choose a tag to compare

Allows you to use ->setLabel('My Custom Label') on a FieldBuilder. Thanks @Log1x and sorry for the delay.

Allow use of other doctrine library versions

06 Dec 19:59
Compare
Choose a tag to compare

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 !!

Field Wrapper Methods

14 Sep 17:16
68e3705
Compare
Choose a tag to compare

@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.

Fix dependancies

06 Sep 03:01
43d1b68
Compare
Choose a tag to compare
1.7.2

Remove version from composer.json and change doctrine inflector patch…

Remove composer.lock file

12 Aug 21:48
cce83a8
Compare
Choose a tag to compare
Merge pull request #68 from kenvunz/master

Remove `composer.lock`

Added Button Group Field

01 Aug 20:49
e46d0fb
Compare
Choose a tag to compare

You can use $fieldsBuilder->addButtonGroup like you would select or radio buttons. See ACF documentation for more information about Button Groups

Thanks @Log1x for the help!