Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation

AbstractOrderConfirmationBlock::render()protectedWC 1.0

Render the block.

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

Хуков нет.

Возвращает

Строку. | void Rendered block output.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->render( $attributes, $content, $block );
$attributes(массив) (обязательный)
Block attributes.
$content(строка) (обязательный)
Block content.
$block(WP_Block) (обязательный)
Block instance.

Код AbstractOrderConfirmationBlock::render() WC 9.4.2

protected function render( $attributes, $content, $block ) {
	$order              = $this->get_order();
	$permission         = $this->get_view_order_permissions( $order );
	$block_content      = $order ? $this->render_content( $order, $permission, $attributes, $content ) : $this->render_content_fallback();
	$classname          = $attributes['className'] ?? '';
	$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes );

	if ( ! empty( $classes_and_styles['classes'] ) ) {
		$classname .= ' ' . $classes_and_styles['classes'];
	}

	return $block_content ? sprintf(
		'<div class="wp-block-%5$s-%4$s wc-block-%4$s %1$s" style="%2$s">%3$s</div>',
		esc_attr( trim( $classname ) ),
		esc_attr( $classes_and_styles['styles'] ),
		$block_content,
		esc_attr( $this->block_name ),
		esc_attr( $this->namespace )
	) : '';
}