You are here

public function ProductHandler::getNodeImageUrl in Mailchimp E-Commerce 8

@inheritdoc

1 call to ProductHandler::getNodeImageUrl()
ProductHandler::buildProductFromNode in src/ProductHandler.php
Build Mailchimp product values from an Ubercart product node.

File

src/ProductHandler.php, line 181

Class

ProductHandler
Product handler.

Namespace

Drupal\mailchimp_ecommerce

Code

public function getNodeImageUrl($product) {
  $image_url = '';
  $config = \Drupal::config('mailchimp_ecommerce.settings');
  $image_field_name = $config
    ->get('product_image');
  if (isset($product->{$image_field_name}->entity)) {
    $image_url = $product->{$image_field_name}->entity
      ->url();
  }
  return $image_url;
}