WC_Admin_Log_Table_List::source_dropdown()
Display source dropdown
Description Description
Source Source
File: includes/admin/class-wc-admin-log-table-list.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
}
}