Automattic\WooCommerce\Blocks\BlockTypes
ProductCategories::renderList()
Render the category list as a list.
Method of the class: ProductCategories{}
No Hooks.
Return
String
. Rendered output.
Usage
// protected - for code of main (parent) or child class $result = $this->renderList( $categories, $attributes, $uid, $depth );
- $categories(array) (required)
- List of terms.
- $attributes(array) (required)
- Block attributes.
Default: empty array - $uid(int) (required)
- Unique ID for the rendered block, used for HTML IDs.
- $depth(int)
- Current depth.
ProductCategories::renderList() ProductCategories::renderList code WC 9.4.2
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; }