public function AddToWishlistLink::url in Commerce Add To Cart Link 8
Same name and namespace in other branches
- 2.x modules/wishlist/src/AddToWishlistLink.php \Drupal\commerce_add_to_wishlist_link\AddToWishlistLink::url()
Generate an URL object for an add-to-wishlist link.
Return value
\Drupal\Core\Url The URL object.
1 call to AddToWishlistLink::url()
- AddToWishlistLink::build in modules/
wishlist/ src/ AddToWishlistLink.php - Generate a render array for an add-to-wishlist link.
File
- modules/
wishlist/ src/ AddToWishlistLink.php, line 54
Class
- AddToWishlistLink
- Defines a helper class for constructing add to wishlist links.
Namespace
Drupal\commerce_add_to_wishlist_linkCode
public function url() {
/** @var \Drupal\commerce_add_to_cart_link\CartLinkTokenInterface $cart_link_token_service */
$cart_link_token_service = \Drupal::service('commerce_add_to_cart_link.token');
return Url::fromRoute('commerce_add_to_wishlist_link.page', [
'commerce_product' => $this->variation
->getProductId(),
'commerce_product_variation' => $this->variation
->id(),
'token' => $cart_link_token_service
->generate($this->variation),
]);
}