mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-03 22:27:04 +00:00
Editor: Update WordPress packages for 6.0 Beta 2
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 Beta 1. Props zieladam, ndiego. See #55567. git-svn-id: https://develop.svn.wordpress.org/trunk@53219 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -8,11 +8,17 @@
|
||||
/**
|
||||
* Function that recursively renders a list of nested comments.
|
||||
*
|
||||
* @param WP_Comment[] $comments The array of comments.
|
||||
* @param WP_Comment[] $comments The array of comments.
|
||||
* @param WP_Block $block Block instance.
|
||||
* @return string
|
||||
*/
|
||||
function block_core_comment_template_render_comments( $comments, $block ) {
|
||||
global $comment_depth;
|
||||
|
||||
if ( empty( $comment_depth ) ) {
|
||||
$comment_depth = 1;
|
||||
}
|
||||
|
||||
$content = '';
|
||||
foreach ( $comments as $comment ) {
|
||||
|
||||
@@ -28,14 +34,20 @@ function block_core_comment_template_render_comments( $comments, $block ) {
|
||||
// If the comment has children, recurse to create the HTML for the nested
|
||||
// comments.
|
||||
if ( ! empty( $children ) ) {
|
||||
$comment_depth += 1;
|
||||
$inner_content = block_core_comment_template_render_comments(
|
||||
$children,
|
||||
$block
|
||||
);
|
||||
$block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
|
||||
$comment_depth -= 1;
|
||||
}
|
||||
|
||||
$content .= '<li>' . $block_content . '</li>';
|
||||
// The `false` parameter at the end means that we do NOT want the function to `echo` the output but to return a string.
|
||||
// See https://developer.wordpress.org/reference/functions/comment_class/#parameters.
|
||||
$comment_classes = comment_class( '', $comment->comment_ID, $comment->comment_post_ID, false );
|
||||
|
||||
$content .= sprintf( '<li id="comment-%1$s" %2$s>%3$s</li>', $comment->comment_ID, $comment_classes, $block_content );
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
||||
Reference in New Issue
Block a user