Automattic\WooCommerce\Blocks\BlockTypes
EmptyMiniCartContentsBlock::render_experimental_empty_mini_cart_contents
Render the experimental interactivity API powered Filled Mini-Cart Contents block.
Method of the class: EmptyMiniCartContentsBlock{}
No Hooks.
Returns
String. Rendered block type output.
Usage
// protected - for code of main (parent) or child class $result = $this->render_experimental_empty_mini_cart_contents( $attributes, $content, $block );
- $attributes(array) (required)
- Block attributes.
- $content(string) (required)
- Block content.
- $block(WP_Block) (required)
- Block instance.
EmptyMiniCartContentsBlock::render_experimental_empty_mini_cart_contents() EmptyMiniCartContentsBlock::render experimental empty mini cart contents code WC 10.3.6
<?php
protected function render_experimental_empty_mini_cart_contents( $attributes, $content, $block ) {
$wrapper_attributes = get_block_wrapper_attributes(
array(
'data-wp-bind--aria-hidden' => '!state.cartIsEmpty',
'data-wp-bind--hidden' => '!state.cartIsEmpty',
'data-wp-interactive' => 'woocommerce/mini-cart',
)
);
ob_start();
?>
<div <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="wc-block-mini-cart__empty-cart-wrapper">
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $content;
?>
</div>
</div>
<?php
return ob_get_clean();
}