Skip to content

Commit

Permalink
- add fixes back (test passes πŸ‘)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbahl committed Mar 5, 2024
1 parent 03557e1 commit ae3f979
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/FieldConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function get_field_description(): string {
// Fallback description
// translators: %s is the name of the ACF Field Group
$description = sprintf(
// translators: %1$s is the ACF Field Type and %2$s is the name of the ACF Field Group
// translators: %1$s is the ACF Field Type and %2$s is the name of the ACF Field Group
__( 'Field of the "%1$s" Field Type added to the schema as part of the "%2$s" Field Group', 'wpgraphql-acf' ),
$this->acf_field['type'] ?? '',
$this->registry->get_field_group_graphql_type_name( $this->acf_field_group )
Expand Down Expand Up @@ -390,11 +390,17 @@ public function resolve_field( $root, array $args, AppContext $context, ResolveI

// If the root being passed down already has a value
// for the field key, let's use it to resolve
if ( ! empty( $root[ $field_key ] ) ) {
return $this->prepare_acf_field_value( $root[ $field_key ], $node, $node_id, $field_config );
if ( isset( $field_config['key'] ) && ! empty( $root[ $field_config['key'] ] ) ) {
return $this->prepare_acf_field_value( $root[ $field_config['key'] ], $node, $node_id, $field_config );
}

if ( ! empty( $root[ $field_config['name'] ] ) ) {
// Check if the cloned field key is being used to pass values down
if ( isset( $field_config['__key'] ) && ! empty( $root[ $field_config['__key'] ] ) ) {
return $this->prepare_acf_field_value( $root[ $field_config['__key'] ], $node, $node_id, $field_config );
}

// Else check if the values are being passed down via the name
if ( isset( $field_config['name'] ) && ! empty( $root[ $field_config['name'] ] ) ) {
return $this->prepare_acf_field_value( $root[ $field_config['name'] ], $node, $node_id, $field_config );
}

Expand Down

0 comments on commit ae3f979

Please sign in to comment.