Make WordPress Core


Ignore:
Timestamp:
11/25/2020 01:18:25 AM (4 years ago)
Author:
noisysocks
Message:

Editor: Remove render_block hooks from WP_Block

Reverts the move of pre_render_block, render_block_data, and
render_block_context to WP_Block.

This change has more implications than first thought so will be revisted later
in 5.7.

Reverts [49609,49608].
See #51612.

File:
1 edited

Legend:

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

    r49608 r49695  
    663663
    664664    /**
    665      * Allows render_block() or WP_Block::render() to be short-circuited, by
    666      * returning a non-null value.
     665     * Allows render_block() to be short-circuited, by returning a non-null value.
    667666     *
    668667     * @since 5.1.0
     
    675674        return $pre_render;
    676675    }
     676
     677    $source_block = $parsed_block;
     678
     679    /**
     680     * Filters the block being rendered in render_block(), before it's processed.
     681     *
     682     * @since 5.1.0
     683     *
     684     * @param array $parsed_block The block being rendered.
     685     * @param array $source_block An un-modified copy of $parsed_block, as it appeared in the source content.
     686     */
     687    $parsed_block = apply_filters( 'render_block_data', $parsed_block, $source_block );
    677688
    678689    $context = array();
     
    697708    }
    698709
     710    /**
     711     * Filters the default context provided to a rendered block.
     712     *
     713     * @since 5.5.0
     714     *
     715     * @param array $context      Default context.
     716     * @param array $parsed_block Block being rendered, filtered by `render_block_data`.
     717     */
     718    $context = apply_filters( 'render_block_context', $context, $parsed_block );
     719
    699720    $block = new WP_Block( $parsed_block, $context );
    700721
Note: See TracChangeset for help on using the changeset viewer.