Automattic\WooCommerce\Blocks\BlockTypes

ProductCategories::renderList()protectedWC 1.0

Render the category list as a list.

Метод класса: ProductCategories{}

Хуков нет.

Возвращает

Строку. Rendered output.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->renderList( $categories, $attributes, $uid, $depth );
$categories(массив) (обязательный)
List of terms.
$attributes(массив) (обязательный)
Block attributes.
По умолчанию: empty array
$uid(int) (обязательный)
Unique ID for the rendered block, used for HTML IDs.
$depth(int)
Current depth.

Код ProductCategories::renderList() WC 8.7.0

protected function renderList( $categories, $attributes, $uid, $depth = 0 ) {
	$classes = [
		'wc-block-product-categories-list',
		'wc-block-product-categories-list--depth-' . absint( $depth ),
	];
	if ( ! empty( $attributes['hasImage'] ) ) {
		$classes[] = 'wc-block-product-categories-list--has-images';
	}
	$output = '<ul class="' . esc_attr( implode( ' ', $classes ) ) . '">' . $this->renderListItems( $categories, $attributes, $uid, $depth ) . '</ul>';

	return $output;
}