Automattic\WooCommerce\Blocks\BlockTypes

MiniCartContents::render_experimental_iapi_mini_cart_contentsprotectedWC 1.0

Render experimental iAPI powered Mini-Cart Contents block.

Method of the class: MiniCartContents{}

No Hooks.

Returns

String. Rendered block type output.

Usage

// protected - for code of main (parent) or child class
$result = $this->render_experimental_iapi_mini_cart_contents( $attributes, $content, $block );
$attributes(array) (required)
Block attributes.
$content(string) (required)
Block content.
$block(WP_Block) (required)
Block instance.

MiniCartContents::render_experimental_iapi_mini_cart_contents() code WC 10.6.2

<?php
protected function render_experimental_iapi_mini_cart_contents( $attributes, $content, $block ) {
	$wrapper_attributes = get_block_wrapper_attributes(
		array(
			'data-wp-interactive' => 'woocommerce/mini-cart-contents',
		)
	);

	ob_start();
	?>
	<div <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
		<div class="wc-block-components-drawer__close-wrapper">
			<button data-wp-on--click="woocommerce/mini-cart::actions.closeDrawer" class="wc-block-components-button wp-element-button wc-block-components-drawer__close contained" aria-label="Close" type="button">
				<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false">
					<path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"></path>
				</svg>
			</button>
		</div>
		<?php
			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
			echo $content;
		?>
	</div>
	<?php
	return ob_get_clean();
}