Automattic\WooCommerce\Blocks\BlockTypes

ProductRatingCounter::get_block_type_supportsprivateWC 1.0

Get the block's attributes.

Method of the class: ProductRatingCounter{}

No Hooks.

Returns

Array. Block attributes merged with defaults.

Usage

// private - for code of main (parent) class only
$result = $this->parse_attributes( $attributes );
$attributes(array) (required)
Block attributes.
Default: empty array

ProductRatingCounter::get_block_type_supports() code WC 9.9.3

private function parse_attributes( $attributes ) {
	// These should match what's set in JS `registerBlockType`.
	$defaults = array(
		'productId'                           => 0,
		'isDescendentOfQueryLoop'             => false,
		'textAlign'                           => '',
		'isDescendentOfSingleProductBlock'    => false,
		'isDescendentOfSingleProductTemplate' => false,
	);

	return wp_parse_args( $attributes, $defaults );
}

/**
 * Overwrite parent method to prevent script registration.
 *
 * It is necessary to register and enqueues assets during the render
 * phase because we want to load assets only if the block has the content.
 */
protected function register_block_type_assets() {
	return null;
}