WordPress.org

Make WordPress Core

Ticket #50146: 50146.diff

File 50146.diff, 1.9 KB (added by dlh, 17 months ago)
  • src/wp-includes/blocks.php

    diff --git src/wp-includes/blocks.php src/wp-includes/blocks.php
    index 422b75e945..4b29ae4b12 100644
    function get_comment_delimited_block_content( $block_name = null, $block_attribu 
    220220 *
    221221 * @since 5.3.1
    222222 *
    223  * @param WP_Block_Parser_Block $block A single parsed block object.
     223 * @param WP_Block_Parser_Block|array $block A single parsed block object.
    224224 * @return string String of rendered HTML.
    225225 */
    226226function serialize_block( $block ) {
     227        if ( $block instanceof WP_Block_Parser_Block ) {
     228                $block = (array) $block;
     229        }
     230
    227231        $block_content = '';
    228232
    229233        $index = 0;
    function serialize_block( $block ) { 
    248252 *
    249253 * @since 5.3.1
    250254 *
    251  * @param WP_Block_Parser_Block[] $blocks Parsed block objects.
     255 * @param WP_Block_Parser_Block[]|array[] $blocks Parsed block objects.
    252256 * @return string String of rendered HTML.
    253257 */
    254258function serialize_blocks( $blocks ) {
    function filter_block_content( $text, $allowed_html = 'post', $allowed_protocols 
    286290 *
    287291 * @since 5.3.1
    288292 *
    289  * @param WP_Block_Parser_Block $block             The parsed block object.
     293 * @param WP_Block_Parser_Block|array $block       The parsed block object.
    290294 * @param array[]|string        $allowed_html      An array of allowed HTML
    291295 *                                                 elements and attributes, or a
    292296 *                                                 context name such as 'post'.
    function filter_block_content( $text, $allowed_html = 'post', $allowed_protocols 
    294298 * @return array The filtered and sanitized block object result.
    295299 */
    296300function filter_block_kses( $block, $allowed_html, $allowed_protocols = array() ) {
     301        if ( $block instanceof WP_Block_Parser_Block ) {
     302                $block = (array) $block;
     303        }
     304
    297305        $block['attrs'] = filter_block_kses_value( $block['attrs'], $allowed_html, $allowed_protocols );
    298306
    299307        if ( is_array( $block['innerBlocks'] ) ) {