public function WishlistEventSubscriber::displayAddToWishlistMessage in Commerce Wishlist 8.3
Displays an add to wishlist message.
Parameters
\Drupal\commerce_wishlist\Event\WishlistEntityAddEvent $event: The add to wishlist event.
File
- src/
EventSubscriber/ WishlistEventSubscriber.php, line 58
Class
- WishlistEventSubscriber
- Defines the wishlist event subscriber.
Namespace
Drupal\commerce_wishlist\EventSubscriberCode
public function displayAddToWishlistMessage(WishlistEntityAddEvent $event) {
$purchased_entity = $event
->getEntity();
$this->messenger
->addStatus($this
->t('@entity added to <a href=":url">your wishlist</a>.', [
'@entity' => $purchased_entity
->label(),
':url' => Url::fromRoute('commerce_wishlist.page')
->toString(),
]));
}