WC_Admin_Log_Table_List::level_dropdown()publicWC 1.0

Display level dropdown

Метод класса: WC_Admin_Log_Table_List{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Admin_Log_Table_List = new WC_Admin_Log_Table_List();
$WC_Admin_Log_Table_List->level_dropdown();

Заметки

  • Global. wpdb. $wpdb

Код WC_Admin_Log_Table_List::level_dropdown() WC 9.3.3

<?php
public function level_dropdown() {
	$labels = WC_Log_Levels::get_all_level_labels();

	$levels = array_reduce(
		array_keys( $labels ),
		function( $carry, $item ) use ( $labels ) {
			$carry[] = array(
				'value' => $item,
				'label' => $labels[ $item ],
			);

			return $carry;
		},
		array()
	);

	$selected_level = isset( $_REQUEST['level'] ) ? $_REQUEST['level'] : '';
	?>
		<label for="filter-by-level" class="screen-reader-text"><?php esc_html_e( 'Filter by level', 'woocommerce' ); ?></label>
		<select name="level" id="filter-by-level">
			<option<?php selected( $selected_level, '' ); ?> value=""><?php esc_html_e( 'All levels', 'woocommerce' ); ?></option>
			<?php
			foreach ( $levels as $l ) {
				printf(
					'<option%1$s value="%2$s">%3$s</option>',
					selected( $selected_level, $l['value'], false ),
					esc_attr( $l['value'] ),
					esc_html( $l['label'] )
				);
			}
			?>
		</select>
	<?php
}