Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #157 from wp-graphql/release/v0.3.5
Browse files Browse the repository at this point in the history
Release/v0.3.5
  • Loading branch information
jasonbahl authored Jul 27, 2020
2 parents 9bb3d7a + 40c2f3f commit 11a2a10
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ class Config {

protected $type_registry;

/**
* @var array <string> List of field names registered to the Schema
*/
protected $registered_field_names;

/**
* Initialize WPGraphQL to ACF
*
Expand All @@ -48,6 +53,13 @@ public function init( \WPGraphQL\Registry\TypeRegistry $type_registry ) {
$this->add_acf_fields_to_individual_posts();
$this->add_acf_fields_to_users();
$this->add_acf_fields_to_options_pages();

add_filter( 'graphql_resolve_revision_meta_from_parent', function( $should, $object_id, $meta_key, $single ) {
if ( in_array( $meta_key, $this->registered_field_names, true ) ) {
return false;
}
return $should;
}, 10, 4 );
}

/**
Expand Down Expand Up @@ -360,6 +372,8 @@ protected function register_graphql_field( $type_name, $field_name, $config ) {
return false;
}



/**
* filter the field config for custom field types
*
Expand Down Expand Up @@ -729,7 +743,7 @@ protected function register_graphql_field( $type_name, $field_name, $config ) {
$type = $tax_object->graphql_single_name;
}
}

$is_multiple = isset($acf_field['field_type']) && in_array( $acf_field['field_type'], array('checkbox', 'multi_select'));

$field_config = [
Expand Down Expand Up @@ -1035,6 +1049,7 @@ protected function register_graphql_field( $type_name, $field_name, $config ) {

$config = array_merge( $config, $field_config );

$this->registered_field_names[] = $acf_field['name'];
return $this->type_registry->register_field( $type_name, $field_name, $config );
}

Expand Down
2 changes: 1 addition & 1 deletion wp-graphql-acf.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://www.wpgraphql.com
* Text Domain: wp-graphql-acf
* Domain Path: /languages
* Version: 0.3.4
* Version: 0.3.5
* Requires PHP: 7.0
* GitHub Plugin URI: https://github.com/afragen/github-updater
*
Expand Down

0 comments on commit 11a2a10

Please sign in to comment.