Skip to content

Releases: wp-graphql/wpgraphql-acf

v2.0.0-beta.5.1.0

20 Oct 22:01
31c56c6
Compare
Choose a tag to compare

Release Notes

Chores / Bugfixes

  • #102: fix: ACF Field Group Location Rules -> GraphQL Schema mapping bugs
  • #100: fix: bug with CPTUI Imports, post type/taxonomy graphql_single_name not being respected
  • #99: fix: Repeater, Group, File field not resolving properly when used as a field on ACF Blocks

v2.0.0-beta.5.0.0

25 Sep 15:40
2517a5b
Compare
Choose a tag to compare

Release Notes:

New Features

  • ACF Blocks Support: see below for more details
  • ACF Options Page UI Support: see below for more details (closes #83)

Chores / Bugfixes

  • fix: cloning one field was applying the cloned field's field group Interface, leading to additional fields mistakenly showing in the schema (closes #78)
  • ci: add acf-pro-stubs for phpstan
  • fix: clone field resolver bugs on nested groups (flex layouts, repeaters)
  • #85 fix: TermNodes returning null when not array and fix type being set to generic TermNode in Taxonomy field

ACF Blocks Support

This release includes support for ACF Blocks (a premium feature of ACF Pro), while also using WPGraphQL Content Blocks v1.2.0+.

The WPGraphQL Content Blocks plugin is responsible for exposing Editor Blocks to the GraphQL Schema, and now ACF Blocks and their associated ACF Field Groups can be queried as GraphQL Types

Registering ACF Blocks

You can register ACF Blocks using code or using ACF Extended's Block Types UI.

Adding ACF Field Groups to ACF Blocks

ACF Pro allows ACF Field Groups to be assigned to ACF Blocks as a location.

After you've assigned an ACF Field Group to an ACF Block, that field group can be accessed from the block.

Example

Register the Block

Here's an example of registering an ACF Block using ACF Extended's Block Type UI. You could also register the block using code, following ACF's block registration examples.

register-block-type

Assign a Field Group to the Block

Then, using ACF's Field Group UI (or using JSON or PHP) you can create an ACF Field Group and associate it with an ACF Block.

acf-block-fields

See the Block in the GraphQL Schema

Next, you should be able to see the Block and the ACF Field Group associated with the block in the GraphQL Schema.

CleanShot 2023-09-14 at 09 26 44

Use the Block in Content

Next, you can use the block in your content.

CleanShot 2023-09-14 at 09 28 38

Query for the Block

Now you can query for EditorBlocks, and specify fields you want for your specific ACF Blocks:

CleanShot 2023-09-14 at 09 44 49


ACF Options Page UI Support

ACF Pro v6.2+ introduced support for creating Options Pages using the ACF User Interface.

Now you can configure these option pages to show in the GraphQL Schema using the UI.

Here's how it works 👇🏻

Configure Options Page

When registering an Options Page via the ACF PRO v6.2+ UI, you can configure the Options Page to show in graphql, and set the GraphQL Type Name.

CleanShot 2023-09-06 at 15 22 22

You will see the data in the columns on the list options page as well:

CleanShot 2023-09-06 at 15 27 55

Assign a Field Group

If you assign an ACF Field Group to the Options Page:

CleanShot 2023-09-06 at 15 28 53

You will be able to see that the ACF Field Group is associated with the Options Page Type

CleanShot 2023-09-06 at 15 29 33

Query the Options

Then you can fill in values for the options page:

CleanShot 2023-09-06 at 15 30 35

And query for the options in GraphQL:

CleanShot 2023-09-06 at 15 31 47

Registering ACF Option Pages in code

You can still register options pages in PHP as you did before, adding fields graphql_type_name and show_in_graphql like shown below:

acf_add_options_page(
	[
		'page_title' => 'OptionsPageNode',
		'menu_title' => __( 'Options Page Node' ),
		'menu_slug'  => 'options-page-node',
		'capability' => 'edit_posts',
		show_in_graphql' => true,
		'graphql_type_name'   => 'OptionsPageNode',
	]
);

New Contributors

Full Changelog: v2.0.0-beta.4.0.0...v2.0.0-beta.5.0.0

v2.0.0-beta.4.0.0

04 Aug 19:11
d5f2c8c
Compare
Choose a tag to compare

Release Notes

Breaking Changes

Hook / Filter Name Changes

This release contains breaking changes. Action and Filter names have been renamed to be more consistent across the codebase and to follow a "namespace" pattern similar to core ACF.

If you have custom code that was hooking into / filtering WPGraphQL for ACF, check your hook names.

There's a table documenting the name changes here: #67 (comment)

LocationRules namespace change

The LocationRules class has changed from \WPGraphQL\Acf\LocationRules to \WPGraphQL\Acf\LocationRules\LocationRules. It's unlikely that you have custom code referencing this class, but if you do, you'll need to update references.

New Features

  • #67: [BREAKING] feat: introduce new hook and filter names to reduce chances of conflicting with custom code extending the previous version of the plugin.

Chores / Bugfixes

  • #62: fix: prepare values when return_format is set to "array"
  • #68: fix: fieldGroupName was always returning null
  • #69: fix: graphql_description default value incorrect
  • #73: fix: replace filter_input with sanitize_text_field

Full Changelog: v2.0.0-beta.3.1.0...v2.0.0-beta.4.0.0

v2.0.0-beta.3.1.0

06 Jul 22:05
Compare
Choose a tag to compare

Release Notes

Chores / Bugfixes

  • #60: fix: graphql_field_names were being set incorrectly when adding new fields.

Full Changelog: v2.0.0-beta.3.0.0...v2.0.0-beta.3.1.0

v2.0.0-beta.3.0.0

26 Jun 20:14
bb65ca8
Compare
Choose a tag to compare

Release Notes

New Features

  • #46: feat: add "graphql_non_null" setting for fields
  • #54: fix: change namespace from WPGraphQLAcf to WPGraphQL\ACF

Chores / Bugfixes

  • #55: fix: clone fields not resolving properly
  • #47: fix: allow inactive field groups to show in the Schema (but prevent their location rules from being set)

v2.0.0-beta.2.4.0

01 Jun 23:39
Compare
Choose a tag to compare

Release Notes

New Features

  • #47 feat: Expose field groups that are not active, but set to "show_in_graphql" to allow inactive groups to be cloned and used in the schema.

v2.0.0-beta.2.3.0

10 May 22:53
98e67df
Compare
Choose a tag to compare

Release Notes

New Features

  • #38 feat: ACF Extended (Free and PRO) support
  • #39 feat: ACF Options Page support

v2.0.0-beta.2.2.0

08 May 22:37
ad6556c
Compare
Choose a tag to compare

Release Notes

New Features

  • #38 feat: ACF Extended / ACF Extended Pro support

v2.0.0-beta.2.1.0

05 Apr 19:16
afffc70
Compare
Choose a tag to compare

Release Notes

  • #35 feat: add Appsero opt-in telemetry.
  • feat: add checks for dependencies (WPGraphQL, ACF, min versions, etc) before loading functionality. Show admin notice and graphql_debug messages if pre-reqs aren't satisfied.

v2.0.0-beta.2.0.5

04 Apr 17:56
Compare
Choose a tag to compare

Release Notes

  • Computer not thrown at the window like I was tempted to. Ditched the Docker way of doing it and went old-school, copying the workflow from core WPGraphQL repo. Tested things it another branch and everything but the artifact upload worked as expected. That should now work because it will be associated with a tagged release.