Changeset 56065 for trunk/src/wp-includes/blocks/comment-template.php
- Timestamp:
- 06/27/2023 02:20:18 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/comment-template.php
r55737 r56065 26 26 $content = ''; 27 27 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 }; 28 33 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 ); 35 48 36 49 $children = $comment->get_children();
Note: See TracChangeset
for help on using the changeset viewer.