WC_Report_Downloads::column_default()
Get column value.
Метод класса: WC_Report_Downloads{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WC_Report_Downloads = new WC_Report_Downloads(); $WC_Report_Downloads->column_default( $item, $column_name );
- $item(разное) (обязательный)
- Item being displayed.
- $column_name(строка) (обязательный)
- Column name.
Код WC_Report_Downloads::column_default() WC Report Downloads::column default WC 9.4.2
public function column_default( $item, $column_name ) { $permission = null; $product = null; try { $permission = new WC_Customer_Download( $item->permission_id ); $product = wc_get_product( $permission->product_id ); } catch ( Exception $e ) { // Ok to continue rendering other information even if permission and/or product is not found. return; } switch ( $column_name ) { case 'timestamp': echo esc_html( $item->timestamp ); break; case 'product': if ( ! empty( $product ) ) { edit_post_link( esc_html( $product->get_formatted_name() ), '', '', $product->get_id(), 'view-link' ); echo '<div class="row-actions">'; echo '<a href="' . esc_url( add_query_arg( 'product_id', $product->get_id() ) ) . '">' . esc_html__( 'Filter by product', 'woocommerce' ) . '</a>'; echo '</div>'; } break; case 'file': if ( ! empty( $permission ) && ! empty( $product ) ) { // File information. $file = $product->get_file( $permission->get_download_id() ); if ( false === $file ) { echo esc_html__( 'File does not exist', 'woocommerce' ); } else { echo esc_html( $file->get_name() . ' - ' . basename( $file->get_file() ) ); echo '<div class="row-actions">'; echo '<a href="' . esc_url( add_query_arg( 'download_id', $permission->get_download_id() ) ) . '">' . esc_html__( 'Filter by file', 'woocommerce' ) . '</a>'; echo '</div>'; } } break; case 'order': if ( ! empty( $permission ) && ( $order = wc_get_order( $permission->order_id ) ) ) { edit_post_link( esc_html( _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() ), '', '', $permission->order_id, 'view-link' ); echo '<div class="row-actions">'; echo '<a href="' . esc_url( add_query_arg( 'order_id', $order->get_id() ) ) . '">' . esc_html__( 'Filter by order', 'woocommerce' ) . '</a>'; echo '</div>'; } break; case 'user': if ( $item->user_id > 0 ) { $user = get_user_by( 'id', $item->user_id ); if ( ! empty( $user ) ) { echo '<a href="' . esc_url( get_edit_user_link( $item->user_id ) ) . '">' . esc_html( $user->display_name ) . '</a>'; echo '<div class="row-actions">'; echo '<a href="' . esc_url( add_query_arg( 'user_id', $item->user_id ) ) . '">' . esc_html__( 'Filter by user', 'woocommerce' ) . '</a>'; echo '</div>'; } } else { esc_html_e( 'Guest', 'woocommerce' ); } break; case 'user_ip_address': echo esc_html( $item->user_ip_address ); echo '<div class="row-actions">'; echo '<a href="' . esc_url( add_query_arg( 'user_ip_address', $item->user_ip_address ) ) . '">' . esc_html__( 'Filter by IP address', 'woocommerce' ) . '</a>'; echo '</div>'; break; } }