WC_Admin_List_Table_Products::render_products_type_filter()
Render the product type filter for the list table.
Метод класса: WC_Admin_List_Table_Products{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->render_products_type_filter();
Список изменений
С версии 3.5.0 | Введена. |
Код WC_Admin_List_Table_Products::render_products_type_filter() WC Admin List Table Products::render products type filter WC 8.7.0
protected function render_products_type_filter() { $current_product_type = isset( $_REQUEST['product_type'] ) ? wc_clean( wp_unslash( $_REQUEST['product_type'] ) ) : false; // WPCS: input var ok, sanitization ok. $output = '<select name="product_type" id="dropdown_product_type"><option value="">' . esc_html__( 'Filter by product type', 'woocommerce' ) . '</option>'; foreach ( wc_get_product_types() as $value => $label ) { $output .= '<option value="' . esc_attr( $value ) . '" '; $output .= selected( $value, $current_product_type, false ); $output .= '>' . esc_html( $label ) . '</option>'; if ( 'simple' === $value ) { $output .= '<option value="downloadable" '; $output .= selected( 'downloadable', $current_product_type, false ); $output .= '> ' . ( is_rtl() ? '←' : '→' ) . ' ' . esc_html__( 'Downloadable', 'woocommerce' ) . '</option>'; $output .= '<option value="virtual" '; $output .= selected( 'virtual', $current_product_type, false ); $output .= '> ' . ( is_rtl() ? '←' : '→' ) . ' ' . esc_html__( 'Virtual', 'woocommerce' ) . '</option>'; } } $output .= '</select>'; echo $output; // WPCS: XSS ok. }