Automattic\WooCommerce\Blocks\BlockTypes\OrderConfirmation

Status::render()protectedWC 1.0

This block uses a custom render method so that the email verification form can be appended to the block. This does not inherit styles from the parent block.

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

Хуков нет.

Возвращает

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

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

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

Код Status::render() WC 9.6.0

protected function render( $attributes, $content, $block ) {
	$order     = $this->get_order();
	$classname = StyleAttributesUtils::get_classes_by_attributes( $attributes, array( 'extra_classes' ) );

	if ( isset( $attributes['align'] ) ) {
		$classname .= " align{$attributes['align']}";
	}

	$block = parent::render( $attributes, $content, $block );

	if ( ! $block ) {
		return '';
	}

	$account_notice = $this->render_account_notice( $order );

	if ( $account_notice ) {
		$block = sprintf(
			'<div class="wc-block-order-confirmation-status-notices %1$s">%2$s</div>',
			esc_attr( trim( $classname ) ),
			$account_notice
		) . $block;
	}

	$additional_content = $this->render_confirmation_notice( $order );

	if ( $additional_content ) {
		$block = $block . sprintf(
			'<div class="wc-block-order-confirmation-status-description %1$s">%2$s</div>',
			esc_attr( trim( $classname ) ),
			$additional_content
		);
	}

	return $block;
}