Automattic\WooCommerce\Blocks\BlockTypes

FeaturedItem::render_overlay()privateWC 1.0

Renders the block overlay

Method of the class: FeaturedItem{}

No Hooks.

Return

String.

Usage

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

FeaturedItem::render_overlay() code WC 9.4.2

private function render_overlay( $attributes ) {
	if ( isset( $attributes['overlayGradient'] ) ) {
		$overlay_styles = sprintf( 'background-image: %s', $attributes['overlayGradient'] );
	} elseif ( isset( $attributes['overlayColor'] ) ) {
		$overlay_styles = sprintf( 'background-color: %s', $attributes['overlayColor'] );
	} else {
		$overlay_styles = 'background-color: #000000';
	}

	return sprintf( '<div class="background-dim__overlay" style="%s"></div>', esc_attr( $overlay_styles ) );
}