Skip to content

Commit 49a66a7

Browse files
committed
- modify Repeater Fields to return the cloned Type if cloned, instead of returning the resulting type
1 parent 8f299a4 commit 49a66a7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/FieldType/Repeater.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ public static function register_field_type(): void {
2222

2323
$sub_field_group['graphql_type_name'] = $type_name;
2424
$sub_field_group['graphql_field_name'] = $type_name;
25+
$sub_field_group['locations'] = null;
26+
27+
if ( ! empty( $sub_field_group['__key'] ) ) {
28+
$cloned_from = acf_get_field( $sub_field_group['__key'] );
29+
$cloned_parent = ! empty( $cloned_from ) ? $field_config->get_parent_graphql_type_name( $cloned_from ) : null;
30+
if ( ! empty( $cloned_parent ) ) {
31+
$type_name = Utils::format_type_name( $cloned_parent . ' ' . $field_name );
32+
}
33+
}
34+
2535

2636
$field_config->get_registry()->register_acf_field_groups_to_graphql(
2737
[

0 commit comments

Comments
 (0)