From 638a67b7d7e14d9d600eba9f052d7b0cdf4f5aa3 Mon Sep 17 00:00:00 2001 From: Patrick Seelinger Date: Mon, 5 May 2025 16:06:10 -0400 Subject: [PATCH] fix field groups with Block Types set to 'All' not showing up in block schema --- src/LocationRules/LocationRules.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/LocationRules/LocationRules.php b/src/LocationRules/LocationRules.php index 29e56a8..feeead4 100644 --- a/src/LocationRules/LocationRules.php +++ b/src/LocationRules/LocationRules.php @@ -719,14 +719,22 @@ public function determine_block_rules( string $field_group_name, string $param, } if ( '==' === $operator ) { - $acf_block = acf_get_block_type( $value ); + if ( 'all' === $value ) { + $acf_blocks = acf_get_block_types(); + foreach ( $acf_blocks as $acf_block ) { + $type_name = \WPGraphQL\Acf\Utils::get_field_group_name( $acf_block ); + $this->set_graphql_type( $field_group_name, $type_name ); + } + } else { + $acf_block = acf_get_block_type( $value ); - if ( empty( $acf_block ) || ! \WPGraphQL\Acf\Utils::should_field_group_show_in_graphql( $acf_block ) ) { - return; - } + if ( empty( $acf_block ) || ! \WPGraphQL\Acf\Utils::should_field_group_show_in_graphql( $acf_block ) ) { + return; + } - $type_name = \WPGraphQL\Acf\Utils::get_field_group_name( $acf_block ); - $this->set_graphql_type( $field_group_name, $type_name ); + $type_name = \WPGraphQL\Acf\Utils::get_field_group_name( $acf_block ); + $this->set_graphql_type( $field_group_name, $type_name ); + } } if ( '!=' === $operator ) {