Make WordPress Core


Ignore:
Timestamp:
06/27/2023 02:20:18 PM (2 years ago)
Author:
Bernhard Reiter
Message:

Editor: update Wordpress npm packages.

Updates the wordpress npm packages and their dependencies to the latest versions, as well as auto-updates to relevant core PHP files.

Props youknowriad, joemcgill, spacedmonkey, ramonopoly, peterwilsoncc, bernhard-reiter, tyxla, dmsnell.
Fixes #58623.

File:
1 edited

Legend:

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

    r55737 r56065  
    2626    $content = '';
    2727    foreach ( $comments as $comment ) {
     28        $comment_id           = $comment->comment_ID;
     29        $filter_block_context = static function( $context ) use ( $comment_id ) {
     30            $context['commentId'] = $comment_id;
     31            return $context;
     32        };
    2833
    29         $block_content = ( new WP_Block(
    30             $block->parsed_block,
    31             array(
    32                 'commentId' => $comment->comment_ID,
    33             )
    34         ) )->render( array( 'dynamic' => false ) );
     34        /*
     35         * We set commentId context through the `render_block_context` filter so
     36         * that dynamically inserted blocks (at `render_block` filter stage)
     37         * will also receive that context.
     38         */
     39        add_filter( 'render_block_context', $filter_block_context );
     40
     41        /*
     42         * We construct a new WP_Block instance from the parsed block so that
     43         * it'll receive any changes made by the `render_block_data` filter.
     44         */
     45        $block_content = ( new WP_Block( $block->parsed_block ) )->render( array( 'dynamic' => false ) );
     46
     47        remove_filter( 'render_block_context', $filter_block_context );
    3548
    3649        $children = $comment->get_children();
Note: See TracChangeset for help on using the changeset viewer.