From d27f1a212353c2f0d2ac80f53b810717f7868a0a Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Tue, 23 Jul 2024 15:27:29 -0600 Subject: [PATCH 1/5] Merge commit '4e38b10925d1717ecfd0be6d20698ff5f2834d74' into develop --- CHANGELOG.md | 18 +++++++++++++++--- readme.txt | 16 ++++++++++++++++ wpgraphql-acf.php | 4 ++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f00443..f3c30c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,34 @@ # Changelog +## 2.4.0 + +### New Features + +- [#211](https://github.com/wp-graphql/wpgraphql-acf/pull/211): feat: add wp-graphql as required plugin dependency. Thanks @stefanmomm! + +### Chores / Bugfixes + +- [#224](https://github.com/wp-graphql/wpgraphql-acf/pull/224): chore: update issue templates config.yml to link to Discord instead of Slack +- [#223](https://github.com/wp-graphql/wpgraphql-acf/pull/223): chore: update branding assets +- [#214](https://github.com/wp-graphql/wpgraphql-acf/pull/214): chore: bump composer/composer from 2.7.4 to 2.7.7 in the composer group across 1 directory + ## 2.3.0 ## Update Notice This release refactored some internals regarding how Clone fields and Group fields behave. There was no intentional breaking changes to the Schema, but if you are using Clone and Group fields there is a chance that if you were benefiting from a "bug as a feature" there might be some changes that could impact your Schema and/or resolvers, we recommend testing this update on a staging site to ensure things are still working for you as expected. Should you run into any problems, please [open a new issue](https://github.com/wp-graphql/wpgraphql-acf/issues/new/choose) and provide as much detail as possible to help us reproduce the scenario. Thanks! 🙏 -## New Features +### New Features - [#193](https://github.com/wp-graphql/wpgraphql-acf/pull/193): feat: improved handling of clone and group fields -## Chores / Bugfixes +### Chores / Bugfixes - [#194](https://github.com/wp-graphql/wpgraphql-acf/pull/194): ci: test against WordPress 6.5 ## 2.2.0 -## New Features +### New Features - [#181](https://github.com/wp-graphql/wpgraphql-acf/pull/181): feat: update docs Date fields to link to the RFC3339 spec diff --git a/readme.txt b/readme.txt index c9c6a99..5893251 100644 --- a/readme.txt +++ b/readme.txt @@ -120,12 +120,28 @@ This release is a complete re-architecture of WPGraphQL for ACF, introducing bre == Changelog == += 2.4.0 = + +**New Features** + +- [#211](https://github.com/wp-graphql/wpgraphql-acf/pull/211): feat: add wp-graphql as required plugin dependency. Thanks @stefanmomm! + +**Chores / Bugfixes** + +- [#224](https://github.com/wp-graphql/wpgraphql-acf/pull/224): chore: update issue templates config.yml to link to Discord instead of Slack +- [#223](https://github.com/wp-graphql/wpgraphql-acf/pull/223): chore: update branding assets +- [#214](https://github.com/wp-graphql/wpgraphql-acf/pull/214): chore: bump composer/composer from 2.7.4 to 2.7.7 in the composer group across 1 directory + = 2.3.0 = **New Features** +- [#193](https://github.com/wp-graphql/wpgraphql-acf/pull/193): feat: improved handling of clone and group fields + **Chores / Bugfixes** +- [#194](https://github.com/wp-graphql/wpgraphql-acf/pull/194): ci: test against WordPress 6.5 + = 2.2.0 = **New Features** diff --git a/wpgraphql-acf.php b/wpgraphql-acf.php index 205da09..ef0b2ff 100644 --- a/wpgraphql-acf.php +++ b/wpgraphql-acf.php @@ -4,7 +4,7 @@ * Description: WPGraphQL for ACF seamlessly integrates Advanced Custom Fields with WPGraphQL. * Author: WPGraphQL, Jason Bahl * Author URI: https://www.wpgraphql.com - * Version: 2.3.0 + * Version: 2.4.0 * Text Domain: wpgraphql-acf * Requires PHP: 7.3 * Requires at least: 5.9 @@ -31,7 +31,7 @@ } if ( ! defined( 'WPGRAPHQL_FOR_ACF_VERSION' ) ) { - define( 'WPGRAPHQL_FOR_ACF_VERSION', '2.3.0' ); + define( 'WPGRAPHQL_FOR_ACF_VERSION', '2.4.0' ); } if ( ! defined( 'WPGRAPHQL_FOR_ACF_VERSION_WPGRAPHQL_REQUIRED_MIN_VERSION' ) ) { From 170980f2be59abccf02f5afd8f33fbd511757274 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 24 Jul 2024 08:36:03 -0600 Subject: [PATCH 2/5] - phpcs - remove WordPress 5.9 from testing matrix --- .github/workflows/testing-integration.yml | 4 ---- src/AcfGraphQLFieldType.php | 6 ++++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing-integration.yml b/.github/workflows/testing-integration.yml index 5e0f038..eb3d345 100644 --- a/.github/workflows/testing-integration.yml +++ b/.github/workflows/testing-integration.yml @@ -33,12 +33,8 @@ jobs: acf_pro: true wpgraphql_content_blocks: true coverage: 1 - - php: '8.1' - wordpress: '5.9' - php: '7.4' wordpress: '6.1' - - php: '7.3' - wordpress: '5.9' fail-fast: false name: WordPress ${{ matrix.wordpress }}, PHP ${{ matrix.php }}, ACF ${{matrix.acf_version}}, ACF & ACF EXTENDED PRO ${{matrix.acf_pro}}, WPGRAPHQL Content Blocks ${{matrix.wpgraphql_content_blocks}} steps: diff --git a/src/AcfGraphQLFieldType.php b/src/AcfGraphQLFieldType.php index 3881971..887c6fc 100644 --- a/src/AcfGraphQLFieldType.php +++ b/src/AcfGraphQLFieldType.php @@ -166,9 +166,11 @@ public function get_admin_field_settings( array $field, Settings $settings ) { // Get the admin fields for the field type $admin_fields = $this->get_admin_fields( $field, $default_admin_settings, $settings ); + $excluded_admin_fields = $this->get_config( 'exclude_admin_fields' ); + // Remove excluded fields - if ( isset( $this->config['exclude_admin_fields'] ) && is_array( $this->config['exclude_admin_fields'] ) ) { - foreach ( $this->config['exclude_admin_fields'] as $excluded ) { + if ( is_array( $excluded_admin_fields ) ) { + foreach ( $excluded_admin_fields as $excluded ) { unset( $admin_fields[ $excluded ] ); } } From 2a8189dcfe18ecd8bc67d34c72f2b0a69841c0d2 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 24 Jul 2024 12:59:06 -0600 Subject: [PATCH 3/5] - ensure blocks have an ID if one is not set --- src/FieldConfig.php | 13 +++++++++++-- tests/_support/WPUnit/AcfFieldTestCase.php | 8 ++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/FieldConfig.php b/src/FieldConfig.php index 67bf30a..ed7c1e5 100644 --- a/src/FieldConfig.php +++ b/src/FieldConfig.php @@ -447,10 +447,19 @@ public function resolve_field( $root, array $args, AppContext $context, ResolveI // resolve block field - if ( is_array( $node ) && isset( $node['blockName'] ) && isset( $node['attrs'] ) ) { - $block = acf_prepare_block( $node['attrs'] ); + if ( is_array( $node ) && isset( $node['blockName'], $node['attrs'] ) ) { + + $block = $node['attrs']; + + // Ensure the block has an ID + if ( ! isset( $block['id'] ) ) { + $block['id'] = uniqid( 'block_', true ); + } + + $block = acf_prepare_block( $block ); $block_id = acf_get_block_id( $node['attrs'] ); $block_id = acf_ensure_block_id_prefix( $block_id ); + acf_setup_meta( $block['data'], $block_id, true ); $return_value = $this->get_field( $field_config['name'], $parent_field_name, $block_id, $should_format_value ); diff --git a/tests/_support/WPUnit/AcfFieldTestCase.php b/tests/_support/WPUnit/AcfFieldTestCase.php index 7a8f601..8da9b3c 100644 --- a/tests/_support/WPUnit/AcfFieldTestCase.php +++ b/tests/_support/WPUnit/AcfFieldTestCase.php @@ -414,10 +414,10 @@ interfaces { ], ]); - codecept_debug([ - '$content' => $content, - '$parsed_blocks' => parse_blocks( $content ), - ]); +// codecept_debug([ +// '$content' => $content, +// '$parsed_blocks' => parse_blocks( $content ), +// ]); // assert the data is returned as expected self::assertQuerySuccessful( $actual, [ From 11b1eb6ae6aca1c25c1cee202a9b386b655218b9 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 24 Jul 2024 13:07:16 -0600 Subject: [PATCH 4/5] - cleanup --- src/FieldConfig.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/FieldConfig.php b/src/FieldConfig.php index ed7c1e5..375c27b 100644 --- a/src/FieldConfig.php +++ b/src/FieldConfig.php @@ -436,7 +436,6 @@ public function resolve_field( $root, array $args, AppContext $context, ResolveI return $pre_value; } - $parent_field = null; $parent_field_name = null; if ( ! empty( $field_config['parent'] ) ) { $parent_field = acf_get_field( $field_config['parent'] ); @@ -445,7 +444,6 @@ public function resolve_field( $root, array $args, AppContext $context, ResolveI } } - // resolve block field if ( is_array( $node ) && isset( $node['blockName'], $node['attrs'] ) ) { From c5f43cdfa148a7f6ac9bb32a8f40ae72cfaa6b52 Mon Sep 17 00:00:00 2001 From: Jason Bahl Date: Wed, 24 Jul 2024 13:08:01 -0600 Subject: [PATCH 5/5] - fix-cs --- src/FieldConfig.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/FieldConfig.php b/src/FieldConfig.php index 375c27b..624e85a 100644 --- a/src/FieldConfig.php +++ b/src/FieldConfig.php @@ -446,7 +446,6 @@ public function resolve_field( $root, array $args, AppContext $context, ResolveI // resolve block field if ( is_array( $node ) && isset( $node['blockName'], $node['attrs'] ) ) { - $block = $node['attrs']; // Ensure the block has an ID