acf-builder

An Advanced Custom Field Configuration Builder

GPL-2.0 License

Downloads
1.2M
Stars
776
Committers
16

Bot releases are hidden (Show)

acf-builder - Modify / Remove Nested Fields Latest Release

Published by stevep about 3 years ago

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

acf-builder - Fix PHP Stan errors, php clone functionality

Published by stevep over 3 years ago

Merged in some PRs: #133 and #137

Thanks @titouanmathis and @davddo

acf-builder - Conditionals referencing parent fields

Published by stevep over 3 years ago

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.
acf-builder - Add support for doctrine/inflector ^2.0

Published by stevep over 4 years ago

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 !

acf-builder - Add `setLabel` helper

Published by stevep almost 5 years ago

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

acf-builder - Allow use of other doctrine library versions

Published by stevep almost 5 years ago

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

acf-builder - Field Wrapper Methods

Published by stevep about 6 years ago

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

acf-builder - Fix dependancies

Published by stevep about 6 years ago

acf-builder - Remove composer.lock file

Published by stevep about 6 years ago

acf-builder - Added Button Group Field

Published by stevep about 6 years ago

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!

acf-builder - Bug fixes

Published by stevep over 6 years ago

Fixed issues #58 and #59

acf-builder - Accordion Field

Published by stevep almost 7 years ago

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');
acf-builder - Add support for Range field, and other bug fixes

Published by stevep about 7 years ago

Updates:

Features

  • Added addRange method

Bug Fixes

  • Fix some potential issues with modifyField
  • Change modifyField documentation to explicitly say the passed closure needs to return a FieldsBuilder
  • Make PHP 7.2 compatible
  • Maintain PHP 5.4 compatibility by specifying older versions of dependencies
acf-builder - Add Link and Group Fields

Published by stevep about 7 years ago

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.

acf-builder - Add google map field and bug fixes

Published by stevep almost 8 years ago

  • Add Google Map field function #25
  • Fix a bug regarding conditional logic and #26
acf-builder - Internal changes and bug fixes

Published by stevep almost 8 years ago

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.

Other changes:

  • addgetRootContext to get the top level parentContext
  • Make the fieldsBuilder in a RepeaterBuilder protected so sub classes can access it
  • Add getGroupConfig function to FieldsBuilder
  • Use Doctrine\Inflector to handle singularizing plural words on buttons
  • Add support for a Repeater collapsed attribute
  • Expose a fieldExists method to FieldsBuilder

Bug fixes:

  • Fix button label setting for repeater and flexible content
  • rename addPostLink to addPageLink on FieldsBuilder
acf-builder - Moved tests to autoload-dev

Published by stevep over 8 years ago

Moved tests to autoload-dev so they aren't included in production. Issue #18
Updated composer dependencies.

acf-builder - Modify / Remove Fields and Time Picker and DateTime Picker support

Published by stevep over 8 years ago

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

acf-builder - Fix addFieldsBug remove getFieldByName from public API

Published by stevep over 8 years ago

Fixes #8 #11

acf-builder - Fix setLocation bug, adds stand alone autoload file.

Published by stevep over 8 years ago

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.

Package Rankings
Top 0.77% on Packagist.org
Badges
Extracted from project README
Latest Stable Version Build Status Scrutinizer Code Quality Join the chat at https://gitter.im/StoutLogic/acf-builder