WC_Admin_Addons::output_group()private staticWC 1.0

Render a group block including products

{} Это метод класса: WC_Admin_Addons{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$result = WC_Admin_Addons::output_group( $block );
$block(разное) (обязательный)
Block of the page for rendering.

Код WC_Admin_Addons::output_group() WC 7.1.0

<?php
private static function output_group( $block ) {
	$capacity             = $block->capacity ?? 3;
	$product_list_classes = 3 === $capacity ? 'three-column' : 'two-column';
	$product_list_classes = 'products addons-products-' . $product_list_classes;
	?>
		<section class="addon-product-group">
			<h2 class="addon-product-group-title"><?php echo esc_html( $block->title ); ?></h2>
			<div class="addon-product-group-description-container">
				<?php if ( ! empty( $block->description ) ) : ?>
				<div class="addon-product-group-description">
					<?php echo esc_html( $block->description ); ?>
				</div>
				<?php endif; ?>
				<?php if ( null !== $block->url ) : ?>
				<a class="addon-product-group-see-more" href="<?php echo esc_url( $block->url ); ?>">
					<?php esc_html_e( 'See more', 'woocommerce' ); ?>
				</a>
				<?php endif; ?>
			</div>
			<div class="addon-product-group__items">
				<ul class="<?php echo esc_attr( $product_list_classes ); ?>">
				<?php
				$products = array_slice( $block->items, 0, $capacity );
				foreach ( $products as $item ) {
					self::render_product_card( $item );
				}
				?>
				</ul>
			<div>
		</section>
	<?php
}