public function AddToWishlistLink::build in Commerce Add To Cart Link 2.x
Same name and namespace in other branches
- 8 modules/wishlist/src/AddToWishlistLink.php \Drupal\commerce_add_to_wishlist_link\AddToWishlistLink::build()
Generate a render array for an add-to-wishlist link.
Return value
array The render array.
File
- modules/
wishlist/ src/ AddToWishlistLink.php, line 37
Class
- AddToWishlistLink
- Defines a helper class for constructing add to wishlist links.
Namespace
Drupal\commerce_add_to_wishlist_linkCode
public function build() {
$build = [
'#theme' => 'commerce_add_to_wishlist_link',
'#url' => $this
->url(),
'#product_variation' => $this->variation,
];
$metadata = $this
->metadata();
$metadata
->applyTo($build);
return $build;
}