Make WordPress Core

Changeset 44576


Ignore:
Timestamp:
01/14/2019 01:46:56 AM (6 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

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

    r44555 r44576  
    189189    }
    190190
     191    $source_block = $block;
     192
    191193    /**
    192194     * Filters the block being rendered in render_block(), before it's processed.
     
    194196     * @since 5.1.0
    195197     *
    196      * @param array $block The block being rendered.
    197      */
    198     $block = apply_filters( 'render_block_data', $block );
     198     * @param array $block        The block being rendered.
     199     * @param array $source_block An un-modified copy of $block, as it appeared in the source content.
     200     */
     201    $block = apply_filters( 'render_block_data', $block, $source_block );
    199202
    200203    $block_type    = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
Note: See TracChangeset for help on using the changeset viewer.