Automattic\WooCommerce\Blocks\BlockTypes

FeaturedItem::render_bg_image()privateWC 1.0

Renders the featured image as a div background.

Метод класса: FeaturedItem{}

Хуков нет.

Возвращает

Строку.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->render_bg_image( $attributes, $image_url );
$attributes(массив) (обязательный)
Block attributes.
По умолчанию: empty array
$image_url(строка) (обязательный)
Item image url.

Код FeaturedItem::render_bg_image() WC 8.7.0

private function render_bg_image( $attributes, $image_url ) {
	$styles = $this->get_bg_styles( $attributes, $image_url );

	$classes = [ "wc-block-{$this->block_name}__background-image" ];

	if ( $attributes['hasParallax'] ) {
		$classes[] = ' has-parallax';
	}

	return sprintf( '<div class="%1$s" style="%2$s" /></div>', esc_attr( implode( ' ', $classes ) ), esc_attr( $styles ) );
}