Automattic\WooCommerce\Blocks\BlockTypes

CatalogSorting::render()protectedWC 1.0

Render the block.

Method of the class: CatalogSorting{}

No Hooks.

Return

String. | void Rendered block output.

Usage

// protected - for code of main (parent) or child class
$result = $this->render( $attributes, $content, $block );
$attributes(array) (required)
Block attributes.
$content(string) (required)
Block content.
$block(WP_Block) (required)
Block instance.

CatalogSorting::render() code WC 9.4.2

protected function render( $attributes, $content, $block ) {
	ob_start();
	woocommerce_catalog_ordering();
	$catalog_sorting = ob_get_clean();

	if ( ! $catalog_sorting ) {
		return;
	}

	$classname          = isset( $attributes['className'] ) ? $attributes['className'] : '';
	$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes );

	return sprintf(
		'<div class="woocommerce wc-block-catalog-sorting %1$s %2$s" style="%3$s">%4$s</div>',
		esc_attr( $classes_and_styles['classes'] ),
		esc_attr( $classname ),
		esc_attr( $classes_and_styles['styles'] ),
		$catalog_sorting
	);
}