Automattic\WooCommerce\Blocks\BlockTypes
FeaturedItem::render_overlay
Renders the block overlay
Method of the class: FeaturedItem{}
No Hooks.
Returns
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() FeaturedItem::render overlay code WC 10.8.1
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 ) );
}