Skip to content

Commit c1dd9b9

Browse files
authored
[N/A] Fix bug when stdClass is passed into ACF renderCallback function (#5)
1 parent 3412a9d commit c1dd9b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/classes/BlockRegistration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Viget\BlocksToolkit;
99

10+
use stdClass;
1011
use Timber\Timber;
1112
use WP_Block;
1213

@@ -102,7 +103,7 @@ function ( array $metadata ): array {
102103
return $metadata;
103104
}
104105

105-
$metadata['acf']['renderCallback'] = function ( array $block, string $content = '', bool $is_preview = false, int $post_id = 0, ?WP_Block $wp_block = null, array|bool $context = [], bool $is_ajax_render = false ) use ( $metadata ): void {
106+
$metadata['acf']['renderCallback'] = function ( array $block, string $content = '', bool $is_preview = false, int $post_id = 0, WP_Block|stdClass|null $wp_block = null, array|bool $context = [], bool $is_ajax_render = false ) use ( $metadata ): void {
106107
$block_name = str_replace( 'acf/', '', $block['name'] );
107108
$block['slug'] = sanitize_title( $block_name );
108109
if ( empty( $block['path'] ) ) {

0 commit comments

Comments
 (0)