Make WordPress Core

Changeset 51841


Ignore:
Timestamp:
09/21/2021 09:31:35 PM (3 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-block.php

    r51501 r51841  
    242242         *
    243243         * @since 5.0.0
    244          *
    245          * @param string $block_content The block content about to be appended.
    246          * @param array  $block         The full block, including name and attributes.
     244         * @since 5.9.0 The `$instance` parameter was added.
     245         *
     246         * @param string   $block_content The block content about to be appended.
     247         * @param array    $block         The full block, including name and attributes.
     248         * @param WP_Block $instance      The block instance.
    247249         */
    248         $block_content = apply_filters( 'render_block', $block_content, $this->parsed_block );
     250        $block_content = apply_filters( 'render_block', $block_content, $this->parsed_block, $this );
    249251
    250252        /**
     
    255257         *
    256258         * @since 5.7.0
    257          *
    258          * @param string $block_content The block content about to be appended.
    259          * @param array  $block         The full block, including name and attributes.
     259         * @since 5.9.0 The `$instance` parameter was added.
     260         *
     261         * @param string   $block_content The block content about to be appended.
     262         * @param array    $block         The full block, including name and attributes.
     263         * @param WP_Block $instance      The block instance.
    260264         */
    261         $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block );
     265        $block_content = apply_filters( "render_block_{$this->name}", $block_content, $this->parsed_block, $this );
    262266
    263267        return $block_content;
Note: See TracChangeset for help on using the changeset viewer.