本文整理汇总了PHP中Magento\Customer\Model\Session::setBeforeControllerName方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::setBeforeControllerName方法的具体用法?PHP Session::setBeforeControllerName怎么用?PHP Session::setBeforeControllerName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Model\Session
的用法示例。
在下文中一共展示了Session::setBeforeControllerName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeDispatch
/**
* Perform customer authentication and wishlist feature state checks
*
* @param \Magento\Framework\App\ActionInterface $subject
* @param RequestInterface $request
* @return void
* @throws \Magento\Framework\Exception\NotFoundException
*/
public function beforeDispatch(\Magento\Framework\App\ActionInterface $subject, RequestInterface $request)
{
if ($this->authenticationState->isEnabled() && !$this->customerSession->authenticate()) {
$subject->getActionFlag()->set('', 'no-dispatch', true);
if (!$this->customerSession->getBeforeWishlistUrl()) {
$this->customerSession->setBeforeWishlistUrl($this->redirector->getRefererUrl());
}
$this->customerSession->setBeforeWishlistRequest($request->getParams());
$this->customerSession->setBeforeRequestParams($this->customerSession->getBeforeWishlistRequest());
$this->customerSession->setBeforeModuleName('wishlist');
$this->customerSession->setBeforeControllerName('index');
$this->customerSession->setBeforeAction('add');
}
if (!$this->config->isSetFlag('wishlist/general/active')) {
throw new NotFoundException(__('Page not found.'));
}
}