ShowUpdateResult.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Controller\Adminhtml\Order\Create;
  7. use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
  8. use Magento\Backend\App\Action;
  9. use Magento\Backend\Model\View\Result\ForwardFactory;
  10. use Magento\Framework\View\Result\PageFactory;
  11. use Magento\Framework\Controller\Result\RawFactory;
  12. class ShowUpdateResult extends \Magento\Sales\Controller\Adminhtml\Order\Create implements HttpGetActionInterface
  13. {
  14. /**
  15. * @var RawFactory
  16. */
  17. protected $resultRawFactory;
  18. /**
  19. * @param Action\Context $context
  20. * @param \Magento\Catalog\Helper\Product $productHelper
  21. * @param \Magento\Framework\Escaper $escaper
  22. * @param PageFactory $resultPageFactory
  23. * @param ForwardFactory $resultForwardFactory
  24. * @param RawFactory $resultRawFactory
  25. */
  26. public function __construct(
  27. Action\Context $context,
  28. \Magento\Catalog\Helper\Product $productHelper,
  29. \Magento\Framework\Escaper $escaper,
  30. PageFactory $resultPageFactory,
  31. ForwardFactory $resultForwardFactory,
  32. RawFactory $resultRawFactory
  33. ) {
  34. $this->resultRawFactory = $resultRawFactory;
  35. parent::__construct(
  36. $context,
  37. $productHelper,
  38. $escaper,
  39. $resultPageFactory,
  40. $resultForwardFactory
  41. );
  42. }
  43. /**
  44. * Show item update result from loadBlockAction
  45. * to prevent popup alert with resend data question
  46. *
  47. * @return \Magento\Framework\Controller\Result\Raw
  48. */
  49. public function execute()
  50. {
  51. /** @var \Magento\Framework\Controller\Result\Raw $resultRaw */
  52. $resultRaw = $this->resultRawFactory->create();
  53. $session = $this->_objectManager->get(\Magento\Backend\Model\Session::class);
  54. if ($session->hasUpdateResult() && is_scalar($session->getUpdateResult())) {
  55. $resultRaw->setContents($session->getUpdateResult());
  56. }
  57. $session->unsUpdateResult();
  58. return $resultRaw;
  59. }
  60. }