Make WordPress Core


Ignore:
Timestamp:
09/26/2023 02:20:18 PM (10 months ago)
Author:
karmatosed
Message:

Update editor related npm packages

The npm packages needed updating for 6.4 to the latest.

Props mikachan, mukesdpanchal27, luisherranz, youknowriad, tellthemachines, gziolo, ockham, michalczaplinski

Fixes #59411

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/query-pagination-numbers.php

    r52042 r56710  
    1616 */
    1717function render_block_core_query_pagination_numbers( $attributes, $content, $block ) {
    18     $page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
    19     $page     = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
    20     $max_page = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0;
     18    $page_key            = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
     19    $enhanced_pagination = isset( $block->context['enhancedPagination'] ) && $block->context['enhancedPagination'];
     20    $page                = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
     21    $max_page            = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0;
    2122
    2223    $wrapper_attributes = get_block_wrapper_attributes();
    2324    $content            = '';
    2425    global $wp_query;
     26    $mid_size = isset( $block->attributes['midSize'] ) ? (int) $block->attributes['midSize'] : null;
    2527    if ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] ) {
    2628        // Take into account if we have set a bigger `max page`
     
    3133            'total'     => $total,
    3234        );
    33         $content       = paginate_links( $paginate_args );
     35        if ( null !== $mid_size ) {
     36            $paginate_args['mid_size'] = $mid_size;
     37        }
     38        $content = paginate_links( $paginate_args );
    3439    } else {
    3540        $block_query = new WP_Query( build_query_vars_from_query_block( $block, $page ) );
     
    4651            'prev_next' => false,
    4752        );
     53        if ( null !== $mid_size ) {
     54            $paginate_args['mid_size'] = $mid_size;
     55        }
    4856        if ( 1 !== $page ) {
    4957            /**
     
    7886        $wp_query = $prev_wp_query;
    7987    }
     88
    8089    if ( empty( $content ) ) {
    8190        return '';
    8291    }
     92
     93    if ( $enhanced_pagination ) {
     94        $p = new WP_HTML_Tag_Processor( $content );
     95        while ( $p->next_tag(
     96            array(
     97                'tag_name'   => 'a',
     98                'class_name' => 'page-numbers',
     99            )
     100        ) ) {
     101            $p->set_attribute( 'data-wp-on--click', 'actions.core.query.navigate' );
     102        }
     103        $content = $p->get_updated_html();
     104    }
     105
    83106    return sprintf(
    84107        '<div %1$s>%2$s</div>',
Note: See TracChangeset for help on using the changeset viewer.