Automattic\WooCommerce\Internal\Admin\Logging\FileV2

FileListTable::extra_tablenav()protectedWC 1.0

Displays extra controls between bulk actions and pagination.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->extra_tablenav( $which ): void;
$which(строка) (обязательный)
The location of the tablenav being rendered. 'top' or 'bottom'.

Код FileListTable::extra_tablenav() WC 9.7.1

<?php
protected function extra_tablenav( $which ): void {
	$all_sources = $this->get_sources_list();

	// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
	$current_source = File::sanitize_source( wp_unslash( $_GET['source'] ?? '' ) );

	?>
	<div class="alignleft actions">
		<?php if ( 'top' === $which ) : ?>
			<label for="filter-by-source" class="screen-reader-text"><?php esc_html_e( 'Filter by log source', 'woocommerce' ); ?></label>
			<select name="source" id="filter-by-source">
				<option<?php selected( $current_source, '' ); ?> value=""><?php esc_html_e( 'All sources', 'woocommerce' ); ?></option>
				<?php foreach ( $all_sources as $source ) : ?>
					<option<?php selected( $current_source, $source ); ?> value="<?php echo esc_attr( $source ); ?>">
						<?php echo esc_html( $source ); ?>
					</option>
				<?php endforeach; ?>
			</select>
			<?php
			submit_button(
				__( 'Filter', 'woocommerce' ),
				'',
				'filter_action',
				false,
				array(
					'id' => 'logs-filter-submit',
				)
			);
			?>
		<?php endif; ?>
	</div>
	<?php
}