Skip to content

Commit

Permalink
Block Library: Remove post- prefix from Comment Template inner bloc…
Browse files Browse the repository at this point in the history
…ks (#36171)

* Block Library: Remove `post-` prefix from Comment Template inner blocks

* Add CHANGELOG entry for `@wordpress/icons`

* Update the tinner template for Comment Template
  • Loading branch information
gziolo committed Nov 4, 2021
1 parent 34b3c60 commit 79ea9f9
Show file tree
Hide file tree
Showing 84 changed files with 263 additions and 215 deletions.
104 changes: 52 additions & 52 deletions lib/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,58 +52,58 @@ function gutenberg_reregister_core_block_types() {
'embed',
),
'block_names' => array(
'archives.php' => 'core/archives',
'block.php' => 'core/block',
'calendar.php' => 'core/calendar',
'categories.php' => 'core/categories',
'file.php' => 'core/file',
'latest-comments.php' => 'core/latest-comments',
'latest-posts.php' => 'core/latest-posts',
'loginout.php' => 'core/loginout',
'navigation.php' => 'core/navigation',
'navigation-link.php' => 'core/navigation-link',
'navigation-submenu.php' => 'core/navigation-submenu',
'home-link.php' => 'core/home-link',
'rss.php' => 'core/rss',
'search.php' => 'core/search',
'shortcode.php' => 'core/shortcode',
'social-link.php' => 'core/social-link',
'tag-cloud.php' => 'core/tag-cloud',
'page-list.php' => 'core/page-list',
'pattern.php' => 'core/pattern',
'post-author.php' => 'core/post-author',
'post-comment.php' => 'core/post-comment',
'post-comment-author.php' => 'core/post-comment-author',
'post-comment-author-avatar.php' => 'core/post-comment-author-avatar',
'post-comment-content.php' => 'core/post-comment-content',
'post-comment-date.php' => 'core/post-comment-date',
'post-comment-edit.php' => 'core/post-comment-edit',
'post-comment-reply-link.php' => 'core/post-comment-reply-link',
'post-comments.php' => 'core/post-comments',
'post-comments-count.php' => 'core/post-comments-count',
'post-comments-form.php' => 'core/post-comments-form',
'post-comments-link.php' => 'core/post-comments-link',
'comment-template.php' => 'core/comment-template',
'post-content.php' => 'core/post-content',
'post-date.php' => 'core/post-date',
'post-excerpt.php' => 'core/post-excerpt',
'post-featured-image.php' => 'core/post-featured-image',
'post-terms.php' => 'core/post-terms',
'post-navigation-link.php' => 'core/post-navigation-link',
'post-title.php' => 'core/post-title',
'query.php' => 'core/query',
'post-template.php' => 'core/post-template',
'query-title.php' => 'core/query-title',
'query-pagination.php' => 'core/query-pagination',
'query-pagination-next.php' => 'core/query-pagination-next',
'query-pagination-numbers.php' => 'core/query-pagination-numbers',
'query-pagination-previous.php' => 'core/query-pagination-previous',
'site-logo.php' => 'core/site-logo',
'site-tagline.php' => 'core/site-tagline',
'site-title.php' => 'core/site-title',
// 'table-of-contents.php' => 'core/table-of-contents',
'template-part.php' => 'core/template-part',
'term-description.php' => 'core/term-description',
'archives.php' => 'core/archives',
'block.php' => 'core/block',
'calendar.php' => 'core/calendar',
'categories.php' => 'core/categories',
'comment-author-avatar.php' => 'core/comment-author-avatar',
'comment-author-name.php' => 'core/comment-author-name',
'comment-content.php' => 'core/comment-content',
'comment-date.php' => 'core/comment-date',
'comment-edit-link.php' => 'core/comment-edit-link',
'comment-reply-link.php' => 'core/comment-reply-link',
'comment-template.php' => 'core/comment-template',
'file.php' => 'core/file',
'home-link.php' => 'core/home-link',
'latest-comments.php' => 'core/latest-comments',
'latest-posts.php' => 'core/latest-posts',
'loginout.php' => 'core/loginout',
'navigation.php' => 'core/navigation',
'navigation-link.php' => 'core/navigation-link',
'navigation-submenu.php' => 'core/navigation-submenu',
'page-list.php' => 'core/page-list',
'pattern.php' => 'core/pattern',
'post-author.php' => 'core/post-author',
'post-comment.php' => 'core/post-comment',
'post-comments.php' => 'core/post-comments',
'post-comments-count.php' => 'core/post-comments-count',
'post-comments-form.php' => 'core/post-comments-form',
'post-comments-link.php' => 'core/post-comments-link',
'post-content.php' => 'core/post-content',
'post-date.php' => 'core/post-date',
'post-excerpt.php' => 'core/post-excerpt',
'post-featured-image.php' => 'core/post-featured-image',
'post-navigation-link.php' => 'core/post-navigation-link',
'post-terms.php' => 'core/post-terms',
'post-title.php' => 'core/post-title',
'query.php' => 'core/query',
'post-template.php' => 'core/post-template',
'query-pagination.php' => 'core/query-pagination',
'query-pagination-next.php' => 'core/query-pagination-next',
'query-pagination-numbers.php' => 'core/query-pagination-numbers',
'query-pagination-previous.php' => 'core/query-pagination-previous',
'query-title.php' => 'core/query-title',
'rss.php' => 'core/rss',
'search.php' => 'core/search',
'shortcode.php' => 'core/shortcode',
'social-link.php' => 'core/social-link',
'site-logo.php' => 'core/site-logo',
'site-tagline.php' => 'core/site-tagline',
'site-title.php' => 'core/site-title',
// 'table-of-contents.php' => 'core/table-of-contents',
'tag-cloud.php' => 'core/tag-cloud',
'template-part.php' => 'core/template-part',
'term-description.php' => 'core/term-description',
),
),
__DIR__ . '/../build/edit-widgets/blocks/' => array(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"apiVersion": 2,
"name": "core/post-comment-author-avatar",
"name": "core/comment-author-avatar",
"title": "Comment Author Avatar",
"category": "theme",
"parent": [ "core/comment-template" ],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { postCommentReplyLink as icon } from '@wordpress/icons';
import { commentAuthorAvatar as icon } from '@wordpress/icons';

/**
* Internal dependencies
Expand All @@ -13,6 +13,6 @@ const { name } = metadata;
export { metadata, name };

export const settings = {
edit,
icon,
edit,
};
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* Server-side rendering of the `core/post-comment-author-avatar` block.
* Server-side rendering of the `core/comment-author-avatar` block.
*
* @package WordPress
*/

/**
* Renders the `core/post-comment-author-avatar` block on the server.
* Renders the `core/comment-author-avatar` block on the server.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
* @return string Return the post comment's avatar.
*/
function render_block_core_post_comment_author_avatar( $attributes, $content, $block ) {
function render_block_core_comment_author_avatar( $attributes, $content, $block ) {
if ( ! isset( $block->context['commentId'] ) ) {
return '';
}
Expand Down Expand Up @@ -51,12 +51,12 @@ function render_block_core_post_comment_author_avatar( $attributes, $content, $b
/**
* Registers the `core/comment-author-avatar` block on the server.
*/
function register_block_core_post_comment_author_avatar() {
function register_block_core_comment_author_avatar() {
register_block_type_from_metadata(
__DIR__ . '/post-comment-author-avatar',
__DIR__ . '/comment-author-avatar',
array(
'render_callback' => 'render_block_core_post_comment_author_avatar',
'render_callback' => 'render_block_core_comment_author_avatar',
)
);
}
add_action( 'init', 'register_block_core_post_comment_author_avatar' );
add_action( 'init', 'register_block_core_comment_author_avatar' );
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"apiVersion": 2,
"name": "core/post-comment-author",
"title": "Comment Author",
"name": "core/comment-author-name",
"title": "Comment Author Name",
"category": "theme",
"parent": [ "core/comment-template" ],
"description": "Add the author of this comment.",
"description": "Add the author name of this comment.",
"textdomain": "default",
"attributes": {
"isLink": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { store as coreStore } from '@wordpress/core-data';
import { PanelBody, ToggleControl } from '@wordpress/components';

/**
* Renders the `core/post-comment-author` block on the editor.
* Renders the `core/comment-author-name` block on the editor.
*
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/**
* WordPress dependencies
*/
import { commentAuthorName as icon } from '@wordpress/icons';

/**
* Internal dependencies
*/
import metadata from './block.json';
import edit from './edit';
import deprecated from './deprecated';

/**
* WordPress dependencies
*/
import { commentAuthor as icon } from '@wordpress/icons';

const { name } = metadata;
export { metadata, name };

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* Server-side rendering of the `core/post-comment-author` block.
* Server-side rendering of the `core/comment-author-name` block.
*
* @package WordPress
*/

/**
* Renders the `core/post-comment-author` block on the server.
* Renders the `core/comment-author-name` block on the server.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
* @return string Return the post comment's author.
*/
function render_block_core_post_comment_author( $attributes, $content, $block ) {
function render_block_core_comment_author_name( $attributes, $content, $block ) {
if ( ! isset( $block->context['commentId'] ) ) {
return '';
}
Expand Down Expand Up @@ -44,14 +44,14 @@ function render_block_core_post_comment_author( $attributes, $content, $block )
}

/**
* Registers the `core/post-comment-author` block on the server.
* Registers the `core/comment-author-name` block on the server.
*/
function register_block_core_post_comment_author() {
function register_block_core_comment_author_name() {
register_block_type_from_metadata(
__DIR__ . '/post-comment-author',
__DIR__ . '/comment-author-name',
array(
'render_callback' => 'render_block_core_post_comment_author',
'render_callback' => 'render_block_core_comment_author_name',
)
);
}
add_action( 'init', 'register_block_core_post_comment_author' );
add_action( 'init', 'register_block_core_comment_author_name' );
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"apiVersion": 2,
"name": "core/post-comment-content",
"name": "core/comment-content",
"title": "Comment Content",
"category": "theme",
"parent": [ "core/comment-template" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from '@wordpress/block-editor';

/**
* Renders the `core/post-comment-content` block on the editor.
* Renders the `core/comment-content` block on the editor.
*
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { postCommentContent as icon } from '@wordpress/icons';
import { commentContent as icon } from '@wordpress/icons';

/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* Server-side rendering of the `core/post-comment-content` block.
* Server-side rendering of the `core/comment-content` block.
*
* @package WordPress
*/

/**
* Renders the `core/post-comment-content` block on the server.
* Renders the `core/comment-content` block on the server.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
* @return string Return the post comment's content.
*/
function render_block_core_post_comment_content( $attributes, $content, $block ) {
function render_block_core_comment_content( $attributes, $content, $block ) {
if ( ! isset( $block->context['commentId'] ) ) {
return '';
}
Expand Down Expand Up @@ -43,14 +43,14 @@ function render_block_core_post_comment_content( $attributes, $content, $block )
}

/**
* Registers the `core/post-comment-content` block on the server.
* Registers the `core/comment-content` block on the server.
*/
function register_block_core_post_comment_content() {
function register_block_core_comment_content() {
register_block_type_from_metadata(
__DIR__ . '/post-comment-content',
__DIR__ . '/comment-content',
array(
'render_callback' => 'render_block_core_post_comment_content',
'render_callback' => 'render_block_core_comment_content',
)
);
}
add_action( 'init', 'register_block_core_post_comment_content' );
add_action( 'init', 'register_block_core_comment_content' );
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"apiVersion": 2,
"name": "core/post-comment-date",
"name": "core/comment-date",
"title": "Comment Date",
"category": "theme",
"parent": [ "core/comment-template" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { __, _x } from '@wordpress/i18n';

/**
* Renders the `core/post-comment-date` block on the editor.
* Renders the `core/comment-date` block on the editor.
*
* @param {Object} props React props.
* @param {Object} props.setAttributes Callback for updating block attributes.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/**
* Server-side rendering of the `core/post-comment-date` block.
* Server-side rendering of the `core/comment-date` block.
*
* @package WordPress
*/

/**
* Renders the `core/post-comment-date` block on the server.
* Renders the `core/comment-date` block on the server.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
* @return string Return the post comment's date.
*/
function render_block_core_post_comment_date( $attributes, $content, $block ) {
function render_block_core_comment_date( $attributes, $content, $block ) {
if ( ! isset( $block->context['commentId'] ) ) {
return '';
}
Expand Down Expand Up @@ -43,14 +43,14 @@ function render_block_core_post_comment_date( $attributes, $content, $block ) {
}

/**
* Registers the `core/post-comment-date` block on the server.
* Registers the `core/comment-date` block on the server.
*/
function register_block_core_post_comment_date() {
function register_block_core_comment_date() {
register_block_type_from_metadata(
__DIR__ . '/post-comment-date',
__DIR__ . '/comment-date',
array(
'render_callback' => 'render_block_core_post_comment_date',
'render_callback' => 'render_block_core_comment_date',
)
);
}
add_action( 'init', 'register_block_core_post_comment_date' );
add_action( 'init', 'register_block_core_comment_date' );
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"apiVersion": 2,
"name": "core/post-comment-edit",
"name": "core/comment-edit-link",
"title": "Comment Edit Link",
"category": "theme",
"parent": [ "core/comment-template" ],
Expand Down

0 comments on commit 79ea9f9

Please sign in to comment.