Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation
Totals::render_content
This renders the content of the block within the wrapper.
Метод класса: Totals{}
Хуков нет.
Возвращает
Строку.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->render_content( $order, $permission, $attributes, $content );
- $order(WC_Order) (обязательный)
- Order object.
- $permission(строка|false)
- If the current user can view the order details or not.
По умолчанию: false - $attributes(массив)
- Block attributes.
По умолчанию: [] - $content(строка)
- Original block content.
По умолчанию: ''
Код Totals::render_content() Totals::render content WC 10.3.6
protected function render_content( $order, $permission = false, $attributes = [], $content = '' ) {
if ( ! $permission ) {
return $this->render_content_fallback();
}
$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, [ 'border_color', 'border_radius', 'border_width', 'border_style', 'background_color', 'text_color' ] );
return $this->get_hook_content( 'woocommerce_order_details_before_order_table', [ $order ] ) . '
<table cellspacing="0" class="wc-block-order-confirmation-totals__table ' . esc_attr( $classes_and_styles['classes'] ) . '" style="' . esc_attr( $classes_and_styles['styles'] ) . '">
<thead>
<tr>
<th class="wc-block-order-confirmation-totals__product">' . esc_html__( 'Product', 'woocommerce' ) . '</th>
<th class="wc-block-order-confirmation-totals__total">' . esc_html__( 'Total', 'woocommerce' ) . '</th>
</tr>
</thead>
<tbody>
' . $this->get_hook_content( 'woocommerce_order_details_before_order_table_items', [ $order ] ) . '
' . $this->render_order_details_table_items( $order ) . '
' . $this->get_hook_content( 'woocommerce_order_details_after_order_table_items', [ $order ] ) . '
</tbody>
<tfoot>
' . $this->render_order_details_table_totals( $order ) . '
</tfoot>
</table>
' . $this->render_order_details_customer_note( $order ) . '
' . $this->get_hook_content( 'woocommerce_order_details_after_order_table', [ $order ] ) . '
' . $this->get_hook_content( 'woocommerce_after_order_details', [ $order ] ) . '
';
}