Skip to content

Commit cf50c87

Browse files
committed
- working on location mapping logic
1 parent 25376f7 commit cf50c87

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Registry.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -570,11 +570,7 @@ public function get_graphql_locations_for_field_group( array $field_group, array
570570

571571
// early return if the field group has graphql_types defined
572572
if ( ! empty( $field_group['graphql_types'] ) && is_array( $field_group['graphql_types'] ) ) {
573-
return array_unique( array_filter( $field_group['graphql_types'] ) );
574-
}
575-
576-
if ( ! isset( $field_group['map_graphql_types_from_location_rules'] ) || false !== (bool) $field_group['map_graphql_types_from_location_rules'] ) {
577-
return [];
573+
return array_unique( $field_group['graphql_types'] );
578574
}
579575

580576
if ( empty( $field_group['locations'] ) ) {
@@ -589,9 +585,13 @@ public function get_graphql_locations_for_field_group( array $field_group, array
589585

590586
$field_group_name = Utils::format_field_name( $field_group_name, true );
591587

592-
$location_rules = $this->get_location_rules( $acf_field_groups );
588+
if ( ! isset( $field_group['map_graphql_types_from_location_rules'] ) || true === (bool) $field_group['map_graphql_types_from_location_rules'] ) {
589+
return [];
590+
}
591+
592+
$location_rules = $this->get_location_rules( [ $field_group_name ] );
593593
if ( isset( $location_rules[ $field_group_name ] ) ) {
594-
$graphql_types = $location_rules[ $field_group_name ];
594+
$graphql_types = $location_rules[ $field_group_name ] ?? [];
595595
}
596596

597597
return ! empty( $graphql_types ) && is_array( $graphql_types ) ? array_unique( array_filter( $graphql_types ) ) : [];

0 commit comments

Comments
 (0)