WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\BlockTypes

FeaturedProduct::get_styles() public WC 1.0

Get the styles for the wrapper element (background image, color).

{} It's a method of the class: FeaturedProduct{}

No Hooks.

Return

String.

Usage

$FeaturedProduct = new FeaturedProduct();
$FeaturedProduct->get_styles( $attributes, $product );
$attributes(array) (required)
Block attributes.
Default: empty array
$product(\WC_Product) (required)
Product object.

Code of FeaturedProduct::get_styles() WC 5.7.1

public function get_styles( $attributes, $product ) {
	$style      = '';
	$image_size = 'large';
	if ( 'none' !== $attributes['align'] || $attributes['height'] > 800 ) {
		$image_size = 'full';
	}

	if ( $attributes['mediaId'] ) {
		$image = wp_get_attachment_image_url( $attributes['mediaId'], $image_size );
	} else {
		$image = $this->get_image( $product, $image_size );
	}

	if ( ! empty( $image ) ) {
		$style .= sprintf( 'background-image:url(%s);', esc_url( $image ) );
	}

	if ( isset( $attributes['customOverlayColor'] ) ) {
		$style .= sprintf( 'background-color:%s;', esc_attr( $attributes['customOverlayColor'] ) );
	}

	if ( isset( $attributes['height'] ) ) {
		$style .= sprintf( 'min-height:%dpx;', intval( $attributes['height'] ) );
	}

	if ( is_array( $attributes['focalPoint'] ) && 2 === count( $attributes['focalPoint'] ) ) {
		$style .= sprintf(
			'background-position: %s%% %s%%',
			$attributes['focalPoint']['x'] * 100,
			$attributes['focalPoint']['y'] * 100
		);
	}

	return $style;
}