Skip to content
Permalink
Browse files

Block Editor: Rename the gutenberg_ functions in blocks/latest-commen…

…ts.php.

This was ported manually from WordPress/gutenberg#12326

Props pento, swissspidy.
See #45145. 


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43950 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
youknowriad committed Nov 30, 2018
1 parent 73a41ba commit c52baf9de4cbc7b6d8882b0308af7a6477576a45
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/wp-includes/blocks/latest-comments.php
@@ -26,7 +26,7 @@
* @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
* @return string The post title if set; "(no title)" if no title is set.
*/
function gutenberg_draft_or_post_title( $post = 0 ) {
function wp_latest_comments_draft_or_post_title( $post = 0 ) {
$title = get_the_title( $post );
if ( empty( $title ) ) {
$title = __( '(no title)' );
@@ -42,7 +42,7 @@ function gutenberg_draft_or_post_title( $post = 0 ) {
*
* @return string Returns the post content with latest comments added.
*/
function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
function render_block_core_latest_comments( $attributes = array() ) {
// This filter is documented in wp-includes/widgets/class-wp-widget-recent-comments.php.
$comments = get_comments(
apply_filters(
@@ -94,7 +94,7 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
// `_draft_or_post_title` calls `esc_html()` so we don't need to wrap that call in
// `esc_html`.
$post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . gutenberg_draft_or_post_title( $comment->comment_post_ID ) . '</a>';
$post_title = '<a class="wp-block-latest-comments__comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '">' . wp_latest_comments_draft_or_post_title( $comment->comment_post_ID ) . '</a>';
$list_items_markup .= sprintf(
/* translators: 1: author name (inside <a> or <span> tag, based on if they have a URL), 2: post title related to this comment */
@@ -179,6 +179,6 @@ function gutenberg_render_block_core_latest_comments( $attributes = array() ) {
'enum' => array( 'center', 'left', 'right', 'wide', 'full', '' ),
),
),
'render_callback' => 'gutenberg_render_block_core_latest_comments',
'render_callback' => 'render_block_core_latest_comments',
)
);

0 comments on commit c52baf9

Please sign in to comment.
You can’t perform that action at this time.