Automattic\WooCommerce\Blocks\BlockTypes
RelatedProducts::render_block
If there are no related products, return an empty string.
Метод класса: RelatedProducts{}
Хуков нет.
Возвращает
string. The block content.
Использование
$RelatedProducts = new RelatedProducts(); $RelatedProducts->render_block( $content, $block );
- $content(строка) (обязательный)
- The block content.
- $block(массив) (обязательный)
- The block.
Код RelatedProducts::render_block() RelatedProducts::render block WC 11.1.0
public function render_block( string $content, array $block ) {
if ( ! $this->is_related_products_block( $block ) ) {
return $content;
}
// If there are no related products, render nothing.
$related_products_ids = $this->get_related_products_ids();
if ( count( $related_products_ids ) < 1 ) {
return '';
}
return $content;
}