Automattic\WooCommerce\Blocks\BlockTypes
ProductCategories::renderListItems() protected WC 1.0
Render a list of terms.
{} It's a method of the class: ProductCategories{}
No Hooks.
Return
String. Rendered output.
Usage
// protected - for code of main (parent) or child class $result = $this->renderListItems( $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.
Code of ProductCategories::renderListItems() ProductCategories::renderListItems WC 5.0.0
protected function renderListItems( $categories, $attributes, $uid, $depth = 0 ) {
$output = '';
foreach ( $categories as $category ) {
$output .= '
<li class="wc-block-product-categories-list-item">
<a href="' . esc_attr( get_term_link( $category->term_id, 'product_cat' ) ) . '">
' . $this->get_image_html( $category, $attributes ) . esc_html( $category->name ) . '
</a>
' . $this->getCount( $category, $attributes ) . '
' . ( ! empty( $category->children ) ? $this->renderList( $category->children, $attributes, $uid, $depth + 1 ) : '' ) . '
</li>
';
}
return $output;
}