Form.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Sales\Controller\Guest;
  8. class Form extends \Magento\Framework\App\Action\Action
  9. {
  10. /**
  11. * @var \Magento\Framework\View\Result\PageFactory
  12. */
  13. protected $resultPageFactory;
  14. /**
  15. * @param \Magento\Framework\App\Action\Context $context
  16. * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
  17. */
  18. public function __construct(
  19. \Magento\Framework\App\Action\Context $context,
  20. \Magento\Framework\View\Result\PageFactory $resultPageFactory
  21. ) {
  22. parent::__construct($context);
  23. $this->resultPageFactory = $resultPageFactory;
  24. }
  25. /**
  26. * Order view form page
  27. *
  28. * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
  29. */
  30. public function execute()
  31. {
  32. if ($this->_objectManager->get(\Magento\Customer\Model\Session::class)->isLoggedIn()) {
  33. return $this->resultRedirectFactory->create()->setPath('customer/account/');
  34. }
  35. $resultPage = $this->resultPageFactory->create();
  36. $resultPage->getConfig()->getTitle()->set(__('Orders and Returns'));
  37. $this->_objectManager->get(\Magento\Sales\Helper\Guest::class)->getBreadcrumbs($resultPage);
  38. return $resultPage;
  39. }
  40. }