/** * Display status description as a tooltip on the view-order screen * * @since 1.0.0 * @param int $order_id The order ID */ public function add_order_description_tooltip($order_id) { $order = wc_get_order($order_id); if ($order) { $status = new WC_Order_Status_Manager_Order_Status($order->get_status()); if ($status && ($description = $status->get_description())) { wc_enqueue_js("\n\t\t\t\t\t\$( 'mark.order-status' ).tipTip({ content: '" . esc_js($description) . "' });\n\t\t\t\t"); } } }
/** * Output custom column content * * @since 1.0.0 * @param string $column * @param int $post_id */ public function custom_column_content($column, $post_id) { $status = new WC_Order_Status_Manager_Order_Status($post_id); switch ($column) { case 'icon': $color = $status->get_color(); $icon = $status->get_icon(); $style = ''; if ($color) { if ($icon) { $style = 'color: ' . $color . ';'; } else { $style = 'background-color: ' . $color . '; color: ' . wc_order_status_manager()->icons->get_contrast_text_color($color) . ';'; } } if (is_numeric($icon)) { $icon_src = wp_get_attachment_image_src($icon, 'wc_order_status_icon'); if ($icon_src) { $style .= 'background-image: url( ' . $icon_src[0] . ');'; } } printf('<mark class="%s %s tips" style="%s" data-tip="%s">%s</mark>', sanitize_title($status->get_slug()), $icon ? 'has-icon ' . $icon : '', $style, esc_attr($status->get_name()), esc_html($status->get_name())); break; case 'slug': echo esc_html($status->get_slug()); break; case 'description': echo esc_html($status->get_description()); break; case 'type': printf('<span class="badge %s">%s</span>', sanitize_title($status->get_type()), esc_html($status->get_type())); break; } }