wp/wp-includes/blocks/term-description.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/term-description` block on the server.
     9  * Renders the `core/term-description` block on the server.
       
    10  *
       
    11  * @since 5.9.0
    10  *
    12  *
    11  * @param array $attributes Block attributes.
    13  * @param array $attributes Block attributes.
    12  *
    14  *
    13  * @return string Returns the description of the current taxonomy term, if available
    15  * @return string Returns the description of the current taxonomy term, if available
    14  */
    16  */
    21 
    23 
    22 	if ( empty( $term_description ) ) {
    24 	if ( empty( $term_description ) ) {
    23 		return '';
    25 		return '';
    24 	}
    26 	}
    25 
    27 
    26 	$extra_attributes   = ( isset( $attributes['textAlign'] ) )
    28 	$classes = array();
    27 		? array( 'class' => 'has-text-align-' . $attributes['textAlign'] )
    29 	if ( isset( $attributes['textAlign'] ) ) {
    28 		: array();
    30 		$classes[] = 'has-text-align-' . $attributes['textAlign'];
    29 	$wrapper_attributes = get_block_wrapper_attributes( $extra_attributes );
    31 	}
       
    32 	if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
       
    33 		$classes[] = 'has-link-color';
       
    34 	}
       
    35 	$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
    30 
    36 
    31 	return '<div ' . $wrapper_attributes . '>' . $term_description . '</div>';
    37 	return '<div ' . $wrapper_attributes . '>' . $term_description . '</div>';
    32 }
    38 }
    33 
    39 
    34 /**
    40 /**
    35  * Registers the `core/term-description` block on the server.
    41  * Registers the `core/term-description` block on the server.
       
    42  *
       
    43  * @since 5.9.0
    36  */
    44  */
    37 function register_block_core_term_description() {
    45 function register_block_core_term_description() {
    38 	register_block_type_from_metadata(
    46 	register_block_type_from_metadata(
    39 		__DIR__ . '/term-description',
    47 		__DIR__ . '/term-description',
    40 		array(
    48 		array(