wp/wp-includes/blocks/query-pagination.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/query-pagination` block on the server.
     9  * Renders the `core/query-pagination` 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  * @param string $content    Block default content.
    14  * @param string $content    Block default content.
    13  *
    15  *
    14  * @return string Returns the wrapper for the Query pagination.
    16  * @return string Returns the wrapper for the Query pagination.
    16 function render_block_core_query_pagination( $attributes, $content ) {
    18 function render_block_core_query_pagination( $attributes, $content ) {
    17 	if ( empty( trim( $content ) ) ) {
    19 	if ( empty( trim( $content ) ) ) {
    18 		return '';
    20 		return '';
    19 	}
    21 	}
    20 
    22 
       
    23 	$classes            = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
    21 	$wrapper_attributes = get_block_wrapper_attributes(
    24 	$wrapper_attributes = get_block_wrapper_attributes(
    22 		array(
    25 		array(
    23 			'role'       => 'navigation',
       
    24 			'aria-label' => __( 'Pagination' ),
    26 			'aria-label' => __( 'Pagination' ),
       
    27 			'class'      => $classes,
    25 		)
    28 		)
    26 	);
    29 	);
    27 
    30 
    28 	return sprintf(
    31 	return sprintf(
    29 		'<nav %1$s>%2$s</nav>',
    32 		'<nav %1$s>%2$s</nav>',
    32 	);
    35 	);
    33 }
    36 }
    34 
    37 
    35 /**
    38 /**
    36  * Registers the `core/query-pagination` block on the server.
    39  * Registers the `core/query-pagination` block on the server.
       
    40  *
       
    41  * @since 5.8.0
    37  */
    42  */
    38 function register_block_core_query_pagination() {
    43 function register_block_core_query_pagination() {
    39 	register_block_type_from_metadata(
    44 	register_block_type_from_metadata(
    40 		__DIR__ . '/query-pagination',
    45 		__DIR__ . '/query-pagination',
    41 		array(
    46 		array(