cloakwp / acf-abstractions
A set of OOP abstractions around ACF to improve developer experience.
Package info
github.com/cloak-labs/acf-abstractions
Type:wordpress-plugin
pkg:composer/cloakwp/acf-abstractions
Requires
- php: >=8.4
- cloakwp/core: ^0.0
- composer/installers: ^2.2
- vinkla/extended-acf: dev-feat/v15-cloakwp-deltas as 15.1.0
Requires (Dev)
- phpunit/phpunit: ^11.0 || ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 0.0.24
- 0.0.23
- 0.0.22
- 0.0.21
- 0.0.20
- 0.0.19
- 0.0.18
- 0.0.17
- 0.0.16
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-codex/acf-expanded-editor-icons
- dev-codex/wordpress-7-1-dependencies
- dev-cursor/e2-home-wp-096f
- dev-cursor/innerblocks-layout-defer-096f
This package is auto-updated.
Last update: 2026-11-13 18:53:57 UTC
README
A set of OOP abstractions around ACF to improve developer experience.
This package is meant to be used alongside the wonderful vinkla/extended-acf package, which provides OOP abstractions for registering fields. This package simply extends that package with some useful extras:
- Register ACF Groups with the
FieldGroupclass (a wrapper aroundvinkla/extended-acf'sregister_extended_field_groupfunction) - Register ACF Blocks with the
Blockclass (all registered block instances become accessible via theBlockRegistrysingleton) - Register ACF Options Pages with the
OptionsPageclass - Conditional Choices — a
conditionalChoices()macro for Select/Radio/Checkbox/Button Group fields that show/hide individual choices based on another field’s live value (seedocs/conditional-choices.md) - Query — a reusable
Groupfield for selecting/filtering posts and injecting the resolved results into a block’s REST payload (seedocs/query-field-set.md) - Some useful, special fields that extend ACF's built-in field types:
Query- An ACFGroup(queryby default) with automatic vs manual post selection, optional post-type / taxonomy / limit / ordering controls, and REST injection viainto()/mapUsing()/injectUsing(). Place it like any other field; use unique names for multiple instances.InnerBlocks- An auto-populated ACFFlexible Contentfield enabling you to select/arrange ACF blocks (assuming you register your ACF blocks via this package'sBlockclass). AssigningInnerBlocksas a field of an ACF block enables nesting blocks within each other for powerful block composability. You can control which blocks are available for selection on a per-instance basis via theincludesandexcludesmethods.HorizontalAlignment- An auto-populated ACFButton Groupfield with options forleft,center,right, andjustify(displayed as icons). You can control which of those 4 options are available on a per-instance basis.VerticalAlignment- An auto-populated ACFButton Groupfield with options fortop,center, andbottom(displayed as icons). You can control which of those 3 options are available on a per-instance basis.MenuSelect- An auto-populated ACFSelectfield allowing you to select a registered WordPress menu.PostTypeSelect- An auto-populated ACFSelectfield allowing you to select a registered WordPress post type.ThemeColorPicker- An auto-populated ACFRadio Buttonfield allowing you to select a color from the active theme'stheme.jsoncolor palette, with special CSS styling to mimic the built-in Gutenberg color picker.ResponsiveField- Enable screen breakpoint-specific values for any ACF field by simply wrapping it in aResponsiveFieldinstance (eg.ResponsiveField::make(Number::make('Gap'))). Under-the-hood, it uses aGroupand set ofTabfields, and duplicates the provided field for each breakpoint tab. The resulting value output isyour_field_name: { mobile: '1', tablet: '2', tablet_wide: '3', laptop: '4', desktop: '5', desktop_wide: '6' }. You can define which breakpoints are available on a per-instance basis.
Installation
composer require cloakwp/acf-abstractions
Usage
Docs coming soon -- for now, see the source code of this package's src directory; it's mostly self-documenting.
Block registration integrations
Use onRegister() to attach an integration when a block is registered. The
callback receives the registered block, so it can read the name from its metadata
without duplicating the name in another feature. Each callback runs once per
block instance, after its value filter and field-group registration are wired.
Block::make(__DIR__ . '/block.json') ->onRegister(function (Block $block): void { MyIntegration::register($block); }) ->register();
See InnerBlocks layout loading for deferred definitions, value-aware parsing, editor templates, and integration escape hatches.