Automattic\WooCommerce\Blocks\BlockTypes

ProductReviews::render()protectedWC 1.0

Render the block.

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

Хуков нет.

Возвращает

Строку. Rendered block output.

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

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

Код ProductReviews::render() WC 8.7.0

protected function render( $attributes, $content, $block ) {
	ob_start();

	rewind_posts();
	while ( have_posts() ) {
		the_post();
		comments_template();
	}

	$reviews = ob_get_clean();

	$classname = $attributes['className'] ?? '';

	return sprintf(
		'<div class="wp-block-woocommerce-product-reviews %1$s">
			%2$s
		</div>',
		esc_attr( $classname ),
		$reviews
	);
}