40 private $messageManager;
54 \
Magento\Framework\Message\ManagerInterface $messageManager
60 $this->messageManager = $messageManager;
73 if ($this->authenticationState->isEnabled() && !$this->customerSession->authenticate()) {
74 $subject->getActionFlag()->set(
'',
'no-dispatch',
true);
75 if (!$this->customerSession->getBeforeWishlistUrl()) {
76 $this->customerSession->setBeforeWishlistUrl($this->redirector->getRefererUrl());
78 $this->customerSession->setBeforeWishlistRequest(
$request->getParams());
79 $this->customerSession->setBeforeRequestParams($this->customerSession->getBeforeWishlistRequest());
80 $this->customerSession->setBeforeModuleName(
'wishlist');
81 $this->customerSession->setBeforeControllerName(
'index');
82 $this->customerSession->setBeforeAction(
'add');
84 if (
$request->getActionName() ==
'add') {
85 $this->messageManager->addErrorMessage(
__(
'You must login or register to add items to your wishlist.'));
88 if (!$this->config->isSetFlag(
'wishlist/general/active')) {
__construct(CustomerSession $customerSession, \Magento\Wishlist\Model\AuthenticationStateInterface $authenticationState, ScopeConfigInterface $config, RedirectInterface $redirector, \Magento\Framework\Message\ManagerInterface $messageManager)
beforeDispatch(\Magento\Framework\App\ActionInterface $subject, RequestInterface $request)