Releases: Log1x/acf-composer
v3.0.4
v3.0.3
v3.0.2
v3.0.1
v3.0.0
🎉 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
- Make sure ACF Composer is installed in the same
composer.json
as Acorn. - Run
composer require log1x/acf-composer
to upgrade to^3.0
. - 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 toenqueue()
(#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 toacf_add_options_page()
(#156) - 🧑💻 Register paths on
acf/init
(#163) - 🧑💻 Add Ancestor allow list to block settings (#142)
- 🧑💻 Add support for block
uses_context
andprovides_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
andmanifest
configuration to the ACF Composer config - 🔧 Change the Options
$redirect
property default value tofalse
- 🔧 Change the publish tag to
acf-composer
to make publishing assets easier - 🔧 Comment out default configuration values
- 🔧 Remove unnecessary
suggest
andscripts
configuration - 🗑️ Deprecate the
get()
Partial method - 🗑️ Drop PHP 7.x Support
- 🧑💻 Improve the ACF Composer lifecycle
- 🧑💻 Add a
--status
option to theacf: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
- @ASDWcodes made their first contribution in #116
- @JUVOJustin made their first contribution in #163
- @broskees made their first contribution in #152
- @rleecrewmp made their first contribution in #142
- @pat-flew made their first contribution in #153
- @GianlucaCesari made their first contribution in #158
- @chrillep made their first contribution in #166
- @aon21 made their first contribution in #145
- @kupoback made their first contribution in #154
Full Changelog: v2.1.0...v3.0.0
v2.1.0
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