Automattic\WooCommerce\Blocks\BlockTypes

FeaturedCategory::render_attributes()protectedWC 1.0

Renders the featured category attributes.

Method of the class: FeaturedCategory{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->render_attributes( $category, $attributes );
$category(\WP_Term) (required)
Term object.
$attributes(array) (required)
Block attributes.
Default: empty array

FeaturedCategory::render_attributes() code WC 8.9.0

protected function render_attributes( $category, $attributes ) {
	$title = sprintf(
		'<h2 class="wc-block-featured-category__title">%s</h2>',
		wp_kses_post( $category->name )
	);

	$desc_str = sprintf(
		'<div class="wc-block-featured-category__description">%s</div>',
		wc_format_content( wp_kses_post( $category->description ) )
	);

	$output = $title;
	if ( $attributes['showDesc'] ) {
		$output .= $desc_str;
	}

	return $output;
}