Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Add.php
Go to the documentation of this file.
1 <?php
7 
12 
13 abstract class Add extends Action
14 {
18  protected $customerSession;
19 
24  public function __construct(
25  Context $context,
27  ) {
28  $this->customerSession = $customerSession;
29  parent::__construct($context);
30  }
31 
39  {
40  if (!$this->customerSession->authenticate()) {
41  $this->_actionFlag->set('', 'no-dispatch', true);
42  if (!$this->customerSession->getBeforeUrl()) {
43  $this->customerSession->setBeforeUrl($this->_redirect->getRefererUrl());
44  }
45  }
46  return parent::dispatch($request);
47  }
48 }
_redirect($path, $arguments=[])
Definition: Action.php:167
dispatch(RequestInterface $request)
Definition: Add.php:38
__construct(Context $context, CustomerSession $customerSession)
Definition: Add.php:24