From 0bbfe3b8e2575b773c6fbb455be03dac7d793368 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 14 Jan 2019 01:47:51 +0000 Subject: [PATCH] Blocks: Add a `$source_block` parameter to the `render_block_data` filter. This contains a copy of the block, unmodified by other filter functions, so that plugins have a clean reference to work from, if they need. Props dmsnell. Fixes #45451. Built from https://develop.svn.wordpress.org/trunk@44576 git-svn-id: http://core.svn.wordpress.org/trunk@44407 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 7 +++++-- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index f59fb1b485..829d916bfd 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -188,14 +188,17 @@ function render_block( $block ) { return $pre_render; } + $source_block = $block; + /** * Filters the block being rendered in render_block(), before it's processed. * * @since 5.1.0 * - * @param array $block The block being rendered. + * @param array $block The block being rendered. + * @param array $source_block An un-modified copy of $block, as it appeared in the source content. */ - $block = apply_filters( 'render_block_data', $block ); + $block = apply_filters( 'render_block_data', $block, $source_block ); $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] ); $is_dynamic = $block['blockName'] && null !== $block_type && $block_type->is_dynamic(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 03df80f54d..ba43b24c04 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta1-44575'; +$wp_version = '5.1-beta1-44576'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.