Automattic\WooCommerce\Blocks\BlockTypes\Reviews

ProductReviewsPaginationPrevious::get_pagination_arrowprotectedWC 1.0

Get the pagination arrow.

Method of the class: ProductReviewsPaginationPrevious{}

No Hooks.

Returns

String|null.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_pagination_arrow( $block );
$block(WP_Block) (required)
Block instance.

ProductReviewsPaginationPrevious::get_pagination_arrow() code WC 10.8.1

protected function get_pagination_arrow( $block ) {
	$arrow_map = array(
		'none'    => '',
		'arrow'   => '←',
		'chevron' => '«',
	);

	if ( ! empty( $block->context['reviews/paginationArrow'] ) && ! empty( $arrow_map[ $block->context['reviews/paginationArrow'] ] ) ) {
		$arrow_attribute = $block->context['reviews/paginationArrow'];
		$arrow           = $arrow_map[ $block->context['reviews/paginationArrow'] ];
		$arrow_classes   = "wp-block-woocommerce-product-reviews-pagination-previous-arrow is-arrow-$arrow_attribute";
		return "<span class='$arrow_classes' aria-hidden='true'>$arrow</span>";
	}
	return null;
}