Skip to content

Releases: Log1x/acf-composer

v3.0.4

27 Feb 09:26
99c77dc
Compare
Choose a tag to compare

Change log

Bug fixes

  • 🩹 Fix partial detection when running acf:upgrade (#199)

v3.0.3

27 Feb 09:12
3c885f2
Compare
Choose a tag to compare

Change log

Enhancements

  • 🧑‍💻 Properly implement context throughout the Builder (Fixes #197)
  • 🗑️ Deprecate enqueue() in place of assets($block)
  • 🧑‍💻 Update the upgrade command to replace enqueue() with assets($block)

Full Changelog: v3.0.2...v3.0.3

v3.0.2

26 Feb 22:52
7e3e7df
Compare
Choose a tag to compare

Change log

Bug fixes

  • 🩹 Pass empty array to enqueue()'s $block when replacing with acf:upgrade (#196)

v3.0.1

26 Feb 22:34
736cacc
Compare
Choose a tag to compare

Change log

Bug fixes

  • 🩹 Fix the replacements property in acf:upgrade (Fixes #194)

v3.0.0

26 Feb 21:41
Compare
Choose a tag to compare

🎉 ACF Composer v3 has arrived!

💥 Breaking Change

If you generated Blocks using the --construct option, you will need to manually update the block __construct()'s with a find & replace:

- use Roots\Acorn\Application;
+ use Log1x\AcfComposer\AcfComposer;

- public function __construct(Application $app)
+ public function __construct(AcfComposer $composer)

- parent::__construct($app);
+ parent::__construct($composer);

Once done, continue to the upgrade guide below.

🧑‍💻 Upgrade Guide

  1. Make sure ACF Composer is installed in the same composer.json as Acorn.
  2. Run composer require log1x/acf-composer to upgrade to ^3.0.
  3. Update your class references using wp acorn acf:upgrade.

Going forward, it is recommended to use the new Builder class:

- use StoutLogic\AcfBuilder\FieldsBuilder;
+ use Log1x\AcfComposer\Builder;

- $listItems = new FieldsBuilder('listItems');
+ $listItems = Builder::make('listItems');

When using the new Builder class, you can now use ->addPartial() to add field partials:

- $listItems->addFields($this->get(Partial::class));
+ $listItems->addPartial(Partial::class);

Inside of Blocks, enqueue() has been changed to assets($block):

- public function enqueue()
+ public function assets($block)

Running wp acorn acf:upgrade should do all of the above for you automatically.

Config Changes

There are 2 new entries to the acf.php config if you have it published:

/*
|--------------------------------------------------------------------------
| Custom Field Types
|--------------------------------------------------------------------------
|
| Here you can define custom field types that are not included with ACF
| out of the box. This allows you to use the fluent builder pattern with
| custom field types such as `addEditorPalette()`.
|
*/

'types' => [
    // 'editorPalette' => 'editor_palette',
    // 'phoneNumber' => 'phone_number',
],

/*
|--------------------------------------------------------------------------
| Cache Manifest Path
|--------------------------------------------------------------------------
|
| Here you can define the cache manifest path. Fields are typically cached
| when running the `acf:cache` command. This will cache the built field
| groups and potentially improve performance in complex applications.
|
*/

'manifest' => storage_path('framework/cache'),

Field Group Caching

ACF Composer now includes field group caching. It may be a good idea to add this to your deployment script:

$ wp acorn acf:cache

You can view the status of the cache by running wp acorn acf:cache --status or wp acorn about.

Custom Field Types

Seen in the config changes above is support for adding custom field types to the Builder. This should help tidy up code a bit when using custom types like ACF Phone Number and ACF Editor Palette.

Once defined in config/acf.php, you can generate IDE helpers for them using wp acorn acf:ide-helpers.

- $fields->addField('mobile_number', 'phone_number');
+ $fields->addPhoneNumber('mobile_number');

Please open an issue if you experience any problems.

Change log

Enhancements

  • 💥 Pass $block data to enqueue() (#154)
  • ✨ Add an acf:cache command for caching built field groups (Fixes #176)
  • ✨ Implement a FieldsBuilder wrapper for improved builder support (Fixes #173)
  • ✨ Add an acf:upgrade command to upgrade classes to v3
  • ✨ Add a acf:clear command to clear the ACF Composer cache
  • ✨ Add support for registering individual Composers (Fixes #180)
  • ✨ Add support for InnerBlocks templates (#159)
  • ✨ Add support for Acorn v4 (#183)
  • 🧑‍💻 Allow for non-static example data (#152)
  • 🧑‍💻 Add option to toggle option page visibility (#116)
  • 🧑‍💻 Add $settings property to pass additional settings to acf_add_options_page() (#156)
  • 🧑‍💻 Register paths on acf/init (#163)
  • 🧑‍💻 Add Ancestor allow list to block settings (#142)
  • 🧑‍💻 Add support for block uses_context and provides_context (#153)
  • 🧑‍💻 Add support for block text and background colors (#145)
  • ➕ Add laravel/pint to the project
  • ➕ Add roots/acorn to the project
  • ➖ Remove squizlabs/php_codesniffer from the project
  • 🎨 Improve class syntax and add types
  • 🎨 Improve the block stub docblocks
  • 👷 Tidy up the Dependabot configuration
  • 👷 Update CI workflow (#166)
  • 📝 Update the README for v3
  • 📝 Update docs to convey that ACF Pro is required (#158)
  • 📝 Add notes about block widgets (#172)
  • 🔧 Add types and manifest configuration to the ACF Composer config
  • 🔧 Change the Options $redirect property default value to false
  • 🔧 Change the publish tag to acf-composer to make publishing assets easier
  • 🔧 Comment out default configuration values
  • 🔧 Remove unnecessary suggest and scripts configuration
  • 🗑️ Deprecate the get() Partial method
  • 🗑️ Drop PHP 7.x Support
  • 🧑‍💻 Improve the ACF Composer lifecycle
  • 🧑‍💻 Add a --status option to the acf:cache command
  • 🧑‍💻 Add a warning when fields are generated without ACF being enabled
  • 🧑‍💻 Update generation stubs to utilize the new Builder class
  • 🧑‍💻 Add ACF Composer to acorn about
  • 🙈 Add composer.lock to .gitignore
  • 🚨 Run Pint

Bug fixes

  • 🐛 Fix children option page registration (Fixes #93)

New Contributors

Full Changelog: v2.1.0...v3.0.0

v2.1.0

15 Oct 05:57
71e2695
Compare
Choose a tag to compare

Change log

Enhancements

  • enhance(block): Add missing block render callback properties (#135)
  • enhance(block): Add $context param to block render callback (Fixes #130)
  • enhance(block): Add $wp_block param to block render callback
  • enhance(block): Add $block->context property to access $context
  • enhance(block): Add $block->instance property to access $wp_block
  • chore(block): Add missing $post_id property definition

Bug fixes

  • fix(stub): Fix the partial fields() docblock return type (#134)
  • fix(acf-composer): Fix relative path when using ACF Composer inside of a plugin (Fixes #125) (#133)
  • fix(field): Fix default field setting merge order (Fixes #127) (#132)

v2.0.9

21 Aug 17:10
b19eb3a
Compare
Choose a tag to compare

Change log

Enhancements

  • chore(block): Change $example conditional to explicitly require false to disable block preview (#126)

v2.0.8

13 Aug 11:25
541aba1
Compare
Choose a tag to compare

Change log

Enhancements

  • enhance(block): Conditionally check if $this->example is not null before setting it (#124)
    • This shouldn't be necessary once this bug is fixed in ACF. (#123)
  • chore(block): use acf_register_block_type instead of acf_register_block

v2.0.7

05 Aug 07:59
Compare
Choose a tag to compare

Change log

This might fix random issues related to #109 – not sure.

Enhancements

  • chore(provider): Move $this->app->make to bottom of boot method

v2.0.6

24 Jul 22:58
98cf29c
Compare
Choose a tag to compare

Change log

Bug fixes

  • fix: Replace Str::remove() with str_replace() for Acorn 1.x compatibility