Automattic\WooCommerce\Blocks\BlockTypes\ProductCollection

Renderer::process_pagination_links()privateWC 1.0

Process pagination links within the block content.

Method of the class: Renderer{}

No Hooks.

Return

String. The updated block content.

Usage

// private - for code of main (parent) class only
$result = $this->process_pagination_links( $block_content );
$block_content(string) (required)
The block content.

Renderer::process_pagination_links() code WC 9.6.1

private function process_pagination_links( $block_content ) {
	if ( ! $block_content ) {
		return $block_content;
	}

	$p = new \WP_HTML_Tag_Processor( $block_content );
	$p->next_tag( array( 'class_name' => 'wp-block-query-pagination' ) );

	// This will help us to find the start of the block content using the `seek` method.
	$p->set_bookmark( 'start' );

	$this->update_pagination_anchors( $p, 'page-numbers', 'product-collection-pagination-numbers' );
	$this->update_pagination_anchors( $p, 'wp-block-query-pagination-next', 'product-collection-pagination--next' );
	$this->update_pagination_anchors( $p, 'wp-block-query-pagination-previous', 'product-collection-pagination--previous' );

	return $p->get_updated_html();
}