Automattic\WooCommerce\Blocks\BlockTypes\Reviews
ProductReviewsPagination::render
Render the block.
Method of the class: ProductReviewsPagination{}
No Hooks.
Returns
String. Rendered block type output.
Usage
// protected - for code of main (parent) or child class $result = $this->render( $attributes, $content, $block );
- $attributes(array) (required)
- Block attributes.
- $content(string) (required)
- Block content.
- $block(WP_Block) (required)
- Block instance.
ProductReviewsPagination::render() ProductReviewsPagination::render code WC 10.8.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()
);
}