Skip to content

Commit

Permalink
Comments block: Fix glitches found while backporting (#40628)
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Apr 29, 2022
1 parent 1f695c9 commit e86188d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/block-library/src/comments-title/index.php
Expand Up @@ -60,9 +60,9 @@ function render_block_core_comments_title( $attributes ) {
);
}

/**
* Registers the `core/comments-title` block on the server.
*/
/**
* Registers the `core/comments-title` block on the server.
*/
function register_block_core_comments_title() {
register_block_type_from_metadata(
__DIR__ . '/comments-title',
Expand All @@ -72,4 +72,4 @@ function register_block_core_comments_title() {
);
}

add_action( 'init', 'register_block_core_comments_title' );
add_action( 'init', 'register_block_core_comments_title' );
5 changes: 4 additions & 1 deletion packages/block-library/src/post-comments-form/index.php
Expand Up @@ -25,10 +25,14 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );

add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );

ob_start();
comment_form( array(), $block->context['postId'] );
$form = ob_get_clean();

remove_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );

// We use the outermost wrapping `<div />` returned by `comment_form()`
// which is identified by its default classname `comment-respond` to inject
// our wrapper attributes. This way, it is guaranteed that all styling applied
Expand Down Expand Up @@ -70,4 +74,3 @@ function post_comments_form_block_form_defaults( $fields ) {

return $fields;
}
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );

0 comments on commit e86188d

Please sign in to comment.