You are here

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

Creates a product URL from a node.

Parameters

Node $product: The Commerce product object.

Return value

string The URL of the product.

Overrides ProductHandlerInterface::buildNodeUrl

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

File

src/ProductHandler.php, line 355

Class

ProductHandler
Product handler.

Namespace

Drupal\mailchimp_ecommerce

Code

public function buildNodeUrl(Node $product) {
  global $base_url;

  // Mailchimp will accept an empty string if no URL is available.
  $full_url = '';
  $url = $product
    ->toUrl()
    ->toString();
  if (!empty($url)) {
    $full_url = $base_url . $url;
  }
  return $full_url;
}