Skip to content

Commit

Permalink
Remove interactivity from comments form
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Apr 12, 2023
1 parent a185cd1 commit 67afc66
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/block-library/src/post-comments-form/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@
"wp-block-post-comments-form",
"wp-block-buttons",
"wp-block-button"
],
"viewScript": [ "file:./view.min.js" ]
]
}
9 changes: 7 additions & 2 deletions packages/block-library/src/post-comments-form/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,19 @@ function render_block_core_post_comments_form( $attributes, $content, $block ) {
// to the block is carried along when the comment form is moved to the location
// of the 'Reply' link that the user clicked by Core's `comment-reply.js` script.
$form = str_replace( 'class="comment-respond"', $wrapper_attributes, $form );
$form = str_replace( '</form>', '<div style="color: red;" data-wp-text="state.core.commentsFormError"></div></form>', $form );
$form = str_replace( '</form>', '<div style="color: red;"></div></form>', $form );

// Enqueue the comment-reply script.
// wp_enqueue_script( 'comment-reply' );

$tags = new WP_HTML_Tag_Processor( $form );

$tags->next_tag( array( 'tag_name' => 'FORM', 'id' => 'commentform' ) );
$tags->next_tag(
array(
'tag_name' => 'FORM',
'id' => 'commentform',
)
);
$tags->set_attribute( 'data-wp-on.submit', 'actions.core.commentsFormSubmission' );

return $tags->get_updated_html();
Expand Down

0 comments on commit 67afc66

Please sign in to comment.