Automattic\WooCommerce\Blocks\BlockTypes

MiniCartProductsTableBlock::render_product_details_markupprotectedWC 1.0

Render markup for product details.

Method of the class: MiniCartProductsTableBlock{}

No Hooks.

Returns

String. Rendered product details output.

Usage

// protected - for code of main (parent) or child class
$result = $this->render_product_details_markup( $property );
$property(string) (required)
The property to render in the product details markup.

MiniCartProductsTableBlock::render_product_details_markup() code WC 10.7.0

<?php
protected function render_product_details_markup( $property ) {
	$context = array( 'dataProperty' => $property );

	// If the property is item_data, so not a variation, we need to skip the text directive.
	$is_item_data = 'item_data' === $context['dataProperty'];

	ob_start();
	?>
	<div
		<?php echo wp_interactivity_data_wp_context( $context ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
		class="wc-block-components-product-details"
		data-wp-bind--hidden="state.shouldHideProductDetails"
	>
		<template
			data-wp-each--item-data="state.cartItem.<?php echo esc_attr( $property ); ?>"
			data-wp-each-key="state.cartItemDataKey"
		>
			<?php echo $this->render_product_details_item_markup( $is_item_data ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
		</template>
	</div>
	<?php
	return ob_get_clean();
}