Automattic\WooCommerce\Blocks\BlockTypes\Reviews

ProductReviewsPagination::render │ protected │ WC 1.0

Render the block.

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

Хуков нет.

Возвращает

string. Rendered block type output.

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

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

Код ProductReviewsPagination::render() WC 11.2.1

protected function render( $attributes, $content, $block ) {
	if ( empty( trim( $content ) ) ) {
		return '';
	}

	if ( post_password_required() ) {
		return;
	}

	$classes            = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
	$wrapper_attributes = get_block_wrapper_attributes(
		array(
			'class'               => $classes,
			'data-wp-interactive' => 'woocommerce/product-reviews',
		)
	);

	$p = new \WP_HTML_Tag_Processor( $content );
	while ( $p->next_tag( 'a' ) ) {
		$p->set_attribute( 'data-wp-on--click', 'actions.navigate' );
	}

	return sprintf(
		'<div %1$s>%2$s</div>',
		$wrapper_attributes,
		$p->get_updated_html()
	);
}