From def627bb576c10f721646910eaa86a229988cb7c Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Tue, 2 May 2023 14:14:56 +0600 Subject: [PATCH] Formatting --- lib/experimental/blocks.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/experimental/blocks.php b/lib/experimental/blocks.php index 3d7b8f3290d6c..30ebd28e87bca 100644 --- a/lib/experimental/blocks.php +++ b/lib/experimental/blocks.php @@ -121,13 +121,12 @@ function gutenberg_auto_insert_child_block( $parsed_block, $source_block, $paren * * @param string $block_content The block content. * @param array $block The full block, including name and attributes. - * @param WP_Block $instance The block instance. */ -function gutenberg_auto_insert_blocks( $block_content, $block, $instance ) { - // $block_name = 'core/post-content'; +function gutenberg_auto_insert_blocks( $block_content, $block ) { + // $block_name = 'core/post-content'; // $block_position = 'after'; // Child blocks could be a bit trickier. - $block_name = 'core/comment-template'; + $block_name = 'core/comment-template'; $block_position = 'last-child'; // Can we void infinite loops? @@ -145,12 +144,12 @@ function gutenberg_auto_insert_blocks( $block_content, $block, $instance ) { return $block_content; } - $inserted_block_markup = << END; + $inserted_blocks = parse_blocks( $inserted_block_markup ); $inserted_content = render_block( $inserted_blocks[0] ); @@ -173,4 +172,4 @@ function gutenberg_auto_insert_blocks( $block_content, $block, $instance ) { return $block_content; } -add_filter( 'render_block', 'gutenberg_auto_insert_blocks', 10, 3 ); +add_filter( 'render_block', 'gutenberg_auto_insert_blocks', 10, 2 );