Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation

Downloads::render_content()protectedWC 1.0

This renders the content of the block within the wrapper.

Метод класса: Downloads{}

Хуков нет.

Возвращает

Строку.

Использование

// 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.
По умолчанию: ''

Код Downloads::render_content() WC 9.5.1

protected function render_content( $order, $permission = false, $attributes = [], $content = '' ) {
	$show_downloads = $order && $order->has_downloadable_item() && $order->is_download_permitted();
	$downloads      = $order ? $order->get_downloadable_items() : [];

	if ( ! $permission || ! $show_downloads ) {
		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 '
		<table cellspacing="0" class="wc-block-order-confirmation-downloads__table ' . esc_attr( $classes_and_styles['classes'] ) . '" style="' . esc_attr( $classes_and_styles['styles'] ) . '">
			<thead>
				<tr>
					' . $this->render_order_downloads_column_headers( $order ) . '
				</td>
			</thead>
			<tbody>
				' . $this->render_order_downloads( $order, $downloads ) . '
			</tbody>
		</table>
	';
}