Skip to content

Block Library: Add a Post Comments Form block.#19954

Merged
epiqueras merged 1 commit into
masterfrom
add/post-comments-form
Feb 12, 2020
Merged

Block Library: Add a Post Comments Form block.#19954
epiqueras merged 1 commit into
masterfrom
add/post-comments-form

Conversation

@epiqueras

Copy link
Copy Markdown
Contributor

Description

This PR adds a new Post Comments Form block akin to the Post Title and Post Content blocks.

How has this been tested?

  • Inserted Post Comments Form block in a post.
  • Confirmed post comments form rendered in the editor and front end.
  • Inserted Post Comments Form block in a template.
  • Confirmed post comments form placeholder rendered in the editor and the relevant post comments form rendered in the front end.

Types of Changes

New Feature: There is a new Post Comments Form block for template building.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@@ -0,0 +1,3 @@
export default function PostCommentsFormEdit() {
return 'Post Comments Form Placeholder';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to show a fake form with the possibility to tweak some of comment_form arguments? At least for a start we could use ServerSideRender

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can do that in a follow-up.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a follow-up, it should be very straightforward to add ServerSideRender without any customization.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't render anything in the editor. We need the server-side context work to land to support things like this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm Right. It seems the "ServerSideRender" component could use some tweaks to pass the parent context.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah

if ( ! $post ) {
return '';
}
return comment_form( array(), $post->ID );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking we should be consistent in all of our blocks about supporting the custom className prop and having a block wrapper with the default className.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As part of the common block wrapper that @ellatrix worked on?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That could help making it consistent yes, but for now, we need to add it manually in "edit" functions (the className prop is available there though) and in the server, everything is manual

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@epiqueras epiqueras force-pushed the add/post-comments-form branch from adc2d21 to ef21bfa Compare February 12, 2020 13:50
@epiqueras epiqueras merged commit 32c7d9a into master Feb 12, 2020
@epiqueras epiqueras deleted the add/post-comments-form branch February 12, 2020 14:28
@youknowriad youknowriad modified the milestones: Future, Gutenberg 7.6 Feb 26, 2020
@@ -0,0 +1,3 @@
export default function PostCommentsFormEdit() {
return 'Post Comments Form Placeholder';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text cannot be translated if it's defined statically.

@ellatrix ellatrix mentioned this pull request Jun 16, 2020
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Block Suggestion for a new block

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants