Automattic\WooCommerce\Blocks\BlockTypes
FeaturedItem::get_image_url()
Returns the url the item's image
Method of the class: FeaturedItem{}
No Hooks.
Return
String
.
Usage
// private - for code of main (parent) class only $result = $this->get_image_url( $attributes, $item );
- $attributes(array) (required)
- Block attributes.
Default: empty array - $item(\WP_Term|\WC_Product) (required)
- Item object.
FeaturedItem::get_image_url() FeaturedItem::get image url code WC 9.4.2
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 ); }