class="dashicon dashicons-arrow-right-alt2"
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 20 20"
>
';
return $output;
}
/**
* Render dropdown options list.
*
* @param array $categories List of terms.
* @param array $attributes Block attributes. Default empty array.
* @param int $uid Unique ID for the rendered block, used for HTML IDs.
* @param int $depth Current depth.
* @return string Rendered output.
*/
protected function renderDropdownOptions( $categories, $attributes, $uid, $depth = 0 ) {
$output = '';
foreach ( $categories as $category ) {
$output .= '
' . ( ! empty( $category->children ) ? $this->renderDropdownOptions( $category->children, $attributes, $uid, $depth + 1 ) : '' ) . '
';
}
return $output;
}
/**
* Render the category list as a list.
*
* @param array $categories List of terms.
* @param array $attributes Block attributes. Default empty array.
* @param int $uid Unique ID for the rendered block, used for HTML IDs.
* @param int $depth Current depth.
* @return string Rendered output.
*/
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 = '
' . $this->renderListItems( $categories, $attributes, $uid, $depth ) . '
';
return $output;
}
/**
* Render a list of terms.
*
* @param array $categories List of terms.
* @param array $attributes Block attributes. Default empty array.
* @param int $uid Unique ID for the rendered block, used for HTML IDs.
* @param int $depth Current depth.
* @return string Rendered output.
*/
protected function renderListItems( $categories, $attributes, $uid, $depth = 0 ) {
$output = '';
$link_color_class_and_style = StyleAttributesUtils::get_link_color_class_and_style( $attributes );
$link_color_style = isset( $link_color_class_and_style['style'] ) ? $link_color_class_and_style['style'] : '';
foreach ( $categories as $category ) {
$output .= '
'
. $this->get_image_html( $category, $attributes )
. '' . esc_html( $category->name ) . ''
. ''
. $this->getCount( $category, $attributes )
. ( ! empty( $category->children ) ? $this->renderList( $category->children, $attributes, $uid, $depth + 1 ) : '' ) . '
';
}
return preg_replace( '/\r|\n/', '', $output );
}
/**
* Returns the category image html
*
* @param \WP_Term $category Term object.
* @param array $attributes Block attributes. Default empty array.
* @param string $size Image size, defaults to 'woocommerce_thumbnail'.
* @return string
*/
public function get_image_html( $category, $attributes, $size = 'woocommerce_thumbnail' ) {
if ( empty( $attributes['hasImage'] ) ) {
return '';
}
$image_id = get_term_meta( $category->term_id, 'thumbnail_id', true );
if ( ! $image_id ) {
return '' . wc_placeholder_img( 'woocommerce_thumbnail' ) . '';
}
return '' . wp_get_attachment_image( $image_id, 'woocommerce_thumbnail' ) . '';
}
/**
* Get the count, if displaying.
*
* @param object $category Term object.
* @param array $attributes Block attributes. Default empty array.
* @return string
*/
protected function getCount( $category, $attributes ) {
if ( empty( $attributes['hasCount'] ) ) {
return '';
}
if ( $attributes['isDropdown'] ) {
return '(' . absint( $category->count ) . ')';
}
$screen_reader_text = sprintf(
/* translators: %s number of products in cart. */
_n( '%d product', '%d products', absint( $category->count ), 'woocommerce' ),
absint( $category->count )
);
return ''
. '' . absint( $category->count ) . ''
. '' . esc_html( $screen_reader_text ) . ''
. '';
}
}
Fatal error: Uncaught Error: Class 'Automattic\WooCommerce\Blocks\BlockTypes\ProductCategories' not found in /home/merciket/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php:106
Stack trace:
#0 /home/merciket/public_html/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\BlockTypesController->register_blocks('')
#1 /home/merciket/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#2 /home/merciket/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /home/merciket/public_html/wp-settings.php(643): do_action('init')
#4 /home/merciket/public_html/wp-config.php(92): require_once('/home/merciket/...')
#5 /home/merciket/public_html/wp-load.php(50): require_once('/home/merciket/...')
#6 /home/merciket/public_html/wp-blog-header.php(13): require_once('/home/merciket/...')
#7 /home/merciket/public_html/index.php(17): require('/home/merciket/...')
#8 {main}
thrown in /home/merciket/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php on line 106