Automattic\WooCommerce\Blocks\BlockTypes

FeaturedItem::get_image_url()privateWC 1.0

Returns the url the item's image

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

Хуков нет.

Возвращает

Строку.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_image_url( $attributes, $item );
$attributes(массив) (обязательный)
Block attributes.
По умолчанию: empty array
$item(\WP_Term|\WC_Product) (обязательный)
Item object.

Код FeaturedItem::get_image_url() WC 8.7.0

private function get_image_url( $attributes, $item ) {
	$image_size = 'large';
	if ( 'none' !== $attributes['align'] || $attributes['height'] > 800 ) {
		$image_size = 'full';
	}

	if ( $attributes['mediaId'] ) {
		return wp_get_attachment_image_url( $attributes['mediaId'], $image_size );
	}

	return $this->get_item_image( $item, $image_size );
}