wp/wp-includes/blocks/comment-content.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     5  * @package WordPress
     5  * @package WordPress
     6  */
     6  */
     7 
     7 
     8 /**
     8 /**
     9  * Renders the `core/comment-content` block on the server.
     9  * Renders the `core/comment-content` block on the server.
       
    10  *
       
    11  * @since 6.0.0
    10  *
    12  *
    11  * @param array    $attributes Block attributes.
    13  * @param array    $attributes Block attributes.
    12  * @param string   $content    Block default content.
    14  * @param string   $content    Block default content.
    13  * @param WP_Block $block      Block instance.
    15  * @param WP_Block $block      Block instance.
    14  * @return string Return the post comment's content.
    16  * @return string Return the post comment's content.
    47 		if ( ! $show_pending_links ) {
    49 		if ( ! $show_pending_links ) {
    48 			$comment_text = wp_kses( $comment_text, array() );
    50 			$comment_text = wp_kses( $comment_text, array() );
    49 		}
    51 		}
    50 	}
    52 	}
    51 
    53 
    52 	$classes = '';
    54 	$classes = array();
    53 	if ( isset( $attributes['textAlign'] ) ) {
    55 	if ( isset( $attributes['textAlign'] ) ) {
    54 		$classes .= 'has-text-align-' . $attributes['textAlign'];
    56 		$classes[] = 'has-text-align-' . $attributes['textAlign'];
       
    57 	}
       
    58 	if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
       
    59 		$classes[] = 'has-link-color';
    55 	}
    60 	}
    56 
    61 
    57 	$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
    62 	$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
    58 
    63 
    59 	return sprintf(
    64 	return sprintf(
    60 		'<div %1$s>%2$s%3$s</div>',
    65 		'<div %1$s>%2$s%3$s</div>',
    61 		$wrapper_attributes,
    66 		$wrapper_attributes,
    62 		$moderation_note,
    67 		$moderation_note,
    64 	);
    69 	);
    65 }
    70 }
    66 
    71 
    67 /**
    72 /**
    68  * Registers the `core/comment-content` block on the server.
    73  * Registers the `core/comment-content` block on the server.
       
    74  *
       
    75  * @since 6.0.0
    69  */
    76  */
    70 function register_block_core_comment_content() {
    77 function register_block_core_comment_content() {
    71 	register_block_type_from_metadata(
    78 	register_block_type_from_metadata(
    72 		__DIR__ . '/comment-content',
    79 		__DIR__ . '/comment-content',
    73 		array(
    80 		array(