Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: block type tests failing #231

Merged
merged 6 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/testing-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
16 changes: 16 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
6 changes: 4 additions & 2 deletions src/AcfGraphQLFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/FieldConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] );
Expand All @@ -445,12 +444,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 );
Expand Down
8 changes: 4 additions & 4 deletions tests/_support/WPUnit/AcfFieldTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down
4 changes: 2 additions & 2 deletions wpgraphql-acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -32,7 +32,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' ) ) {
Expand Down
Loading