wp/wp-includes/blocks/comments-pagination-next.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     5  * @package WordPress
     5  * @package WordPress
     6  */
     6  */
     7 
     7 
     8 /**
     8 /**
     9  * Renders the `core/comments-pagination-next` block on the server.
     9  * Renders the `core/comments-pagination-next` 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  *
    16  *
    24 	$max_page         = ( new WP_Comment_Query( $comment_vars ) )->max_num_pages;
    26 	$max_page         = ( new WP_Comment_Query( $comment_vars ) )->max_num_pages;
    25 	$default_label    = __( 'Newer Comments' );
    27 	$default_label    = __( 'Newer Comments' );
    26 	$label            = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
    28 	$label            = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
    27 	$pagination_arrow = get_comments_pagination_arrow( $block, 'next' );
    29 	$pagination_arrow = get_comments_pagination_arrow( $block, 'next' );
    28 
    30 
    29 	$filter_link_attributes = function() {
    31 	$filter_link_attributes = static function () {
    30 		return get_block_wrapper_attributes();
    32 		return get_block_wrapper_attributes();
    31 	};
    33 	};
    32 	add_filter( 'next_comments_link_attributes', $filter_link_attributes );
    34 	add_filter( 'next_comments_link_attributes', $filter_link_attributes );
    33 
    35 
    34 	if ( $pagination_arrow ) {
    36 	if ( $pagination_arrow ) {
    46 }
    48 }
    47 
    49 
    48 
    50 
    49 /**
    51 /**
    50  * Registers the `core/comments-pagination-next` block on the server.
    52  * Registers the `core/comments-pagination-next` block on the server.
       
    53  *
       
    54  * @since 6.0.0
    51  */
    55  */
    52 function register_block_core_comments_pagination_next() {
    56 function register_block_core_comments_pagination_next() {
    53 	register_block_type_from_metadata(
    57 	register_block_type_from_metadata(
    54 		__DIR__ . '/comments-pagination-next',
    58 		__DIR__ . '/comments-pagination-next',
    55 		array(
    59 		array(