Automattic\WooCommerce\Blocks\BlockTypes
ProductCategories::renderListItems() protected WC 1.0
Render a list of terms.
{} Это метод класса: ProductCategories{}
Хуков нет.
Возвращает
Строку
. Rendered output.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->renderListItems( $categories, $attributes, $uid, $depth );
- $categories(массив) (обязательный)
- List of terms.
- $attributes(массив) (обязательный)
- Block attributes.
По умолчанию: empty array - $uid(число) (обязательный)
- Unique ID for the rendered block, used for HTML IDs.
- $depth(число)
- Current depth.
Код ProductCategories::renderListItems() ProductCategories::renderListItems WC 5.2.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;
}