@@ -146,7 +146,7 @@ public function get_field_description(): string {
146146 // Fallback description
147147 // translators: %s is the name of the ACF Field Group
148148 $ description = sprintf (
149- // translators: %1$s is the ACF Field Type and %2$s is the name of the ACF Field Group
149+ // translators: %1$s is the ACF Field Type and %2$s is the name of the ACF Field Group
150150 __ ( 'Field of the "%1$s" Field Type added to the schema as part of the "%2$s" Field Group ' , 'wpgraphql-acf ' ),
151151 $ this ->acf_field ['type ' ] ?? '' ,
152152 $ this ->registry ->get_field_group_graphql_type_name ( $ this ->acf_field_group )
@@ -390,11 +390,17 @@ public function resolve_field( $root, array $args, AppContext $context, ResolveI
390390
391391 // If the root being passed down already has a value
392392 // for the field key, let's use it to resolve
393- if ( ! empty ( $ root [ $ field_key ] ) ) {
394- return $ this ->prepare_acf_field_value ( $ root [ $ field_key ], $ node , $ node_id , $ field_config );
393+ if ( isset ( $ field_config [ ' key ' ] ) && ! empty ( $ root [ $ field_config [ ' key ' ] ] ) ) {
394+ return $ this ->prepare_acf_field_value ( $ root [ $ field_config [ ' key ' ] ], $ node , $ node_id , $ field_config );
395395 }
396396
397- if ( ! empty ( $ root [ $ field_config ['name ' ] ] ) ) {
397+ // Check if the cloned field key is being used to pass values down
398+ if ( isset ( $ field_config ['__key ' ] ) && ! empty ( $ root [ $ field_config ['__key ' ] ] ) ) {
399+ return $ this ->prepare_acf_field_value ( $ root [ $ field_config ['__key ' ] ], $ node , $ node_id , $ field_config );
400+ }
401+
402+ // Else check if the values are being passed down via the name
403+ if ( isset ( $ field_config ['name ' ] ) && ! empty ( $ root [ $ field_config ['name ' ] ] ) ) {
398404 return $ this ->prepare_acf_field_value ( $ root [ $ field_config ['name ' ] ], $ node , $ node_id , $ field_config );
399405 }
400406
0 commit comments