Automattic\WooCommerce\Blocks\BlockTypes

FeaturedCategory::render_attributes()protectedWC 1.0

Renders the featured category attributes.

Метод класса: FeaturedCategory{}

Хуков нет.

Возвращает

Строку.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->render_attributes( $category, $attributes );
$category(\WP_Term) (обязательный)
Term object.
$attributes(массив) (обязательный)
Block attributes.
По умолчанию: empty array

Код FeaturedCategory::render_attributes() WC 7.5.1

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;
}