public function Test::getTrackingUrl in Commerce Shipping 8.2
Gets the tracking url for the given shipment.
Parameters
\Drupal\commerce_shipping\Entity\ShipmentInterface $shipment: The shipment.
Return value
\Drupal\core\Url|null The tracking URL, or NULL if not available yet.
Overrides SupportsTrackingInterface::getTrackingUrl
File
- tests/
modules/ commerce_shipping_test/ src/ Plugin/ Commerce/ ShippingMethod/ Test.php, line 25
Class
- Test
- Provides the Test shipping method.
Namespace
Drupal\commerce_shipping_test\Plugin\Commerce\ShippingMethodCode
public function getTrackingUrl(ShipmentInterface $shipment) {
$tracking_code = $shipment
->getTrackingCode();
if (!empty($tracking_code)) {
return Url::fromUri('https://www.drupal.org/' . $tracking_code);
}
}