From 01ff7448d29fa88102d280c062dbabd4ac484708 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 21 Sep 2021 21:32:57 +0000 Subject: [PATCH] Formatting: Pass the block instance as a parameter to the `render_block` filters. This allows filters to access properties and methods on the block instance. Fixes #53596 Built from https://develop.svn.wordpress.org/trunk@51841 git-svn-id: http://core.svn.wordpress.org/trunk@51446 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-block.php | 16 ++++++++++------ wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/wp-includes/class-wp-block.php b/wp-includes/class-wp-block.php index a8ae6747c4..189ce4e615 100644 --- a/wp-includes/class-wp-block.php +++ b/wp-includes/class-wp-block.php @@ -241,11 +241,13 @@ class WP_Block { * Filters the content of a single block. * * @since 5.0.0 + * @since 5.9.0 The `$instance` parameter was added. * - * @param string $block_content The block content about to be appended. - * @param array $block The full block, including name and attributes. + * @param string $block_content The block content about to be appended. + * @param array $block The full block, including name and attributes. + * @param WP_Block $instance The block instance. */ - $block_content = apply_filters( 'render_block', $block_content, $this->parsed_block ); + $block_content = apply_filters( 'render_block', $block_content, $this->parsed_block, $this ); /** * Filters the content of a single block. @@ -254,11 +256,13 @@ class WP_Block { * the block name, e.g. "core/paragraph". * * @since 5.7.0 + * @since 5.9.0 The `$instance` parameter was added. * - * @param string $block_content The block content about to be appended. - * @param array $block The full block, including name and attributes. + * @param string $block_content The block content about to be appended. + * @param array $block The full block, including name and attributes. + * @param WP_Block $instance The block instance. */ - $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block ); + $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this ); return $block_content; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3d5e40df4c..f0607cc88d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-51837'; +$wp_version = '5.9-alpha-51841'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.