# gutenberg/12.6.0/lib/compat/wordpress-5.9/blocks.php

Gutenberg, version 12.6.0. 45 lines.

- Page: https://pluginprobe.com/plugins/gutenberg/12.6.0/code/lib/compat/wordpress-5.9/blocks.php
- Raw: https://pluginprobe.com/plugins/gutenberg/12.6.0/raw/lib/compat/wordpress-5.9/blocks.php
- Modified: 2022-02-02T16:18:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenberg/12.6.0/code/lib/compat/wordpress-5.9/blocks.php#L10-L20`.

```php
<?php
/**
 * Temporary compatibility shims for features present in Gutenberg.
 * This file should be removed when WordPress 5.9.0 becomes the lowest
 * supported version by this plugin.
 *
 * @package gutenberg
 */

if ( ! function_exists( 'get_query_pagination_arrow' ) ) {
	/**
	 * Helper function that returns the proper pagination arrow html for
	 * `QueryPaginationNext` and `QueryPaginationPrevious` blocks based
	 * on the provided `paginationArrow` from `QueryPagination` context.
	 *
	 * It's used in QueryPaginationNext and QueryPaginationPrevious blocks.
	 *
	 * @param WP_Block $block   Block instance.
	 * @param boolean  $is_next Flag for handling `next/previous` blocks.
	 *
	 * @return string|null Returns the constructed WP_Query arguments.
	 */
	function get_query_pagination_arrow( $block, $is_next ) {
		$arrow_map = array(
			'none'    => '',
			'arrow'   => array(
				'next'     => '→',
				'previous' => '←',
			),
			'chevron' => array(
				'next'     => '»',
				'previous' => '«',
			),
		);
		if ( ! empty( $block->context['paginationArrow'] ) && array_key_exists( $block->context['paginationArrow'], $arrow_map ) && ! empty( $arrow_map[ $block->context['paginationArrow'] ] ) ) {
			$pagination_type = $is_next ? 'next' : 'previous';
			$arrow_attribute = $block->context['paginationArrow'];
			$arrow           = $arrow_map[ $block->context['paginationArrow'] ][ $pagination_type ];
			$arrow_classes   = "wp-block-query-pagination-$pagination_type-arrow is-arrow-$arrow_attribute";
			return "<span class='$arrow_classes'>$arrow</span>";
		}
		return null;
	}
}

```
