Skip to content

Commit d56a92c

Browse files
committed
fix: core-query bug cleanup
1 parent ac7ff9e commit d56a92c

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

includes/Data/ContentBlocksResolver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private static function handle_do_blocks( array $blocks ): array {
141141
foreach ( $blocks as $block ) {
142142
$block_data = self::handle_do_block( $block );
143143

144-
if ( $block_data ) {
144+
if ( ! empty( $block_data ) ) {
145145
$parsed[] = $block_data;
146146
}
147147
}
@@ -326,7 +326,6 @@ private static function populate_pattern_inner_blocks( array $block ): array {
326326
return $block;
327327
}
328328

329-
330329
/**
331330
* Flattens a list blocks into a single array
332331
*

includes/Model/Block.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace WPGraphQL\ContentBlocks\Model;
1111

12-
use WPGraphQL\ContentBlocks\Data\BlockAttributeResolver;
1312
use WPGraphQL\ContentBlocks\Utilities\WPGraphQLHelpers;
1413
use WPGraphQL\Model\Model;
1514

@@ -107,8 +106,7 @@ protected function init() {
107106
*/
108107
protected function get_rendered_block(): ?string {
109108
if ( ! isset( $this->rendered_block ) ) {
110-
$rendered = $this->data->render();
111-
$this->rendered_block = do_shortcode( $rendered );
109+
$this->rendered_block = ! empty( $this->data->parsed_block ) ? render_block( $this->data->parsed_block ) : '';
112110
}
113111

114112
return $this->rendered_block;

includes/Registry/Registry.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public function __construct( TypeRegistry $type_registry, $block_type_registry )
6666
* Registry init procedure.
6767
*/
6868
public function init(): void {
69-
$this->register_interface_types();
7069
$this->register_scalar_types();
7170
$this->register_support_block_types();
71+
$this->register_interface_types();
7272
$this->register_block_types();
7373
}
7474

@@ -200,16 +200,17 @@ public function get_block_attributes_interfaces( string $block_name ): array {
200200
}
201201

202202
$block_interfaces = [];
203-
203+
204204
$block_support_classes = $this->get_block_supports_classes();
205205

206206
foreach ( $block_support_classes as $instance ) {
207207
$interfaces_to_add = $instance::get_attributes_interfaces( $block_spec );
208+
208209
if ( empty( $interfaces_to_add ) ) {
209210
continue;
210211
}
211212

212-
$block_interfaces[] = array_merge( $block_interfaces, $interfaces_to_add );
213+
$block_interfaces = array_merge( $block_interfaces, $interfaces_to_add );
213214
}
214215

215216
// NOTE: Using add_filter here creates a performance penalty.

0 commit comments

Comments
 (0)