NoCookies.php 961 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Cookie\Controller\Index;
  8. class NoCookies extends \Magento\Framework\App\Action\Action
  9. {
  10. /**
  11. * No cookies action
  12. *
  13. * @return void
  14. */
  15. public function execute()
  16. {
  17. $redirect = new \Magento\Framework\DataObject();
  18. $this->_eventManager->dispatch(
  19. 'controller_action_nocookies',
  20. ['action' => $this, 'redirect' => $redirect]
  21. );
  22. $url = $redirect->getRedirectUrl();
  23. if ($url) {
  24. $this->getResponse()->setRedirect($url);
  25. } elseif ($redirect->getRedirect()) {
  26. $this->_redirect($redirect->getPath(), $redirect->getArguments());
  27. } else {
  28. $this->_view->loadLayout(['default', 'noCookie']);
  29. $this->_view->renderLayout();
  30. }
  31. $this->getRequest()->setDispatched(true);
  32. }
  33. }