WC_Admin_Dashboard::sales_sparkline_markup()
Prepares the markup for a sparkline to show sales in the last X days with the given data.
Метод класса: WC_Admin_Dashboard{}
Хуков нет.
Возвращает
Строку
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->sales_sparkline_markup( $type, $days, $total, $sparkline_data );
- $type(строка) (обязательный)
- Type of sparkline to form the markup.
- $days(int) (обязательный)
- Days of stats to form the markup.
- $total(int) (обязательный)
- Total income or items sold to form the markup.
- $sparkline_data(массив) (обязательный)
- Sparkline data to form the markup.
Код WC_Admin_Dashboard::sales_sparkline_markup() WC Admin Dashboard::sales sparkline markup WC 9.7.1
private function sales_sparkline_markup( $type, $days, $total, $sparkline_data ) { if ( 'sales' === $type ) { /* translators: 1: total income 2: days */ $tooltip = sprintf( __( 'Sold %1$s worth in the last %2$d days', 'woocommerce' ), strip_tags( wc_price( $total ) ), $days ); } else { /* translators: 1: total items sold 2: days */ $tooltip = sprintf( _n( 'Sold %1$d item in the last %2$d days', 'Sold %1$d items in the last %2$d days', $total, 'woocommerce' ), $total, $days ); } return '<span class="wc_sparkline ' . ( ( 'sales' === $type ) ? 'lines' : 'bars' ) . ' tips" data-color="#777" data-tip="' . esc_attr( $tooltip ) . '" data-barwidth="' . 60 * 60 * 16 * 1000 . '" data-sparkline="' . wc_esc_json( wp_json_encode( $sparkline_data ) ) . '"></span>'; }