Changeset 52057
- Timestamp:
- 11/08/2021 10:30:41 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r52012 r52057 1147 1147 return $query; 1148 1148 } 1149 1150 /** 1151 * Helper function that returns the proper pagination arrow html for 1152 * `QueryPaginationNext` and `QueryPaginationPrevious` blocks based 1153 * on the provided `paginationArrow` from `QueryPagination` context. 1154 * 1155 * It's used in QueryPaginationNext and QueryPaginationPrevious blocks. 1156 * 1157 * @param WP_Block $block Block instance. 1158 * @param boolean $is_next Flag for hanlding `next/previous` blocks. 1159 * 1160 * @return string|null Returns the constructed WP_Query arguments. 1161 */ 1162 function get_query_pagination_arrow( $block, $is_next ) { 1163 $arrow_map = array( 1164 'none' => '', 1165 'arrow' => array( 1166 'next' => '→', 1167 'previous' => '←', 1168 ), 1169 'chevron' => array( 1170 'next' => '»', 1171 'previous' => '«', 1172 ), 1173 ); 1174 if ( ! empty( $block->context['paginationArrow'] ) && array_key_exists( $block->context['paginationArrow'], $arrow_map ) && ! empty( $arrow_map[ $block->context['paginationArrow'] ] ) ) { 1175 $pagination_type = $is_next ? 'next' : 'previous'; 1176 $arrow_attribute = $block->context['paginationArrow']; 1177 $arrow = $arrow_map[ $block->context['paginationArrow'] ][ $pagination_type ]; 1178 $arrow_classes = "wp-block-query-pagination-$pagination_type-arrow is-arrow-$arrow_attribute"; 1179 return "<span class='$arrow_classes'>$arrow</span>"; 1180 } 1181 return null; 1182 }
Note: See TracChangeset
for help on using the changeset viewer.