Automattic\WooCommerce\Blocks\BlockTypes
MiniCartTitleLabelBlock::render
Render the block.
Метод класса: MiniCartTitleLabelBlock{}
Хуков нет.
Возвращает
string. Rendered block type output.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->render( $attributes, $content, $block );
- $attributes(массив) (обязательный)
- Block attributes.
- $content(строка) (обязательный)
- Block content.
- $block(WP_Block) (обязательный)
- Block instance.
Код MiniCartTitleLabelBlock::render() MiniCartTitleLabelBlock::render WC 11.2.1
<?php
protected function render( $attributes, $content, $block ) {
$default_cart_label = __( 'Your cart', 'woocommerce' );
$cart_label = $attributes['label'] ? $attributes['label'] : $default_cart_label;
$wrapper_attributes = get_block_wrapper_attributes();
ob_start();
?>
<span <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php echo esc_html( $cart_label ); ?>
</span>
<?php
return (string) ob_get_clean();
}