Skip to content

Commit

Permalink
Fix form-submit styles by adding button classes to the submit-button …
Browse files Browse the repository at this point in the history
…in post-comments block (#37245)

* Add button classes to the comments form

* remove function_exists check
  • Loading branch information
aristath authored Dec 10, 2021
1 parent 1b15cf1 commit 26fff37
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/block-library/src/post-comments/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@
"link": true
}
},
"style": "wp-block-post-comments"
"style": [
"wp-block-post-comments",
"wp-block-buttons",
"wp-block-button"
]
}
15 changes: 15 additions & 0 deletions packages/block-library/src/post-comments/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,18 @@ function register_block_core_post_comments() {
);
}
add_action( 'init', 'register_block_core_post_comments' );

/**
* Use the button block classes for the form-submit button.
*
* @param array $fields The default comment form arguments.
*
* @return array Returns the modified fields.
*/
function gutenberg_post_comments_block_form_defaults( $fields ) {
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link" value="%4$s" />';
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';

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

0 comments on commit 26fff37

Please sign in to comment.