WordPress at Your Fingertips
function is not described

WC_Admin_Log_Table_List::source_dropdown() protected WC 1.0

Display source dropdown

{} It's a method of the class: WC_Admin_Log_Table_List{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->source_dropdown();

Notes

  • Global. wpdb. $wpdb

Code of WC_Admin_Log_Table_List::source_dropdown() WC 5.8.0

<?php
protected function source_dropdown() {
	global $wpdb;

	$sources = $wpdb->get_col(
		"SELECT DISTINCT source
		FROM {$wpdb->prefix}woocommerce_log
		WHERE source != ''
		ORDER BY source ASC"
	);

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