Status.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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;
  7. /**
  8. * Order status management controller
  9. */
  10. abstract class Status extends \Magento\Backend\App\Action
  11. {
  12. /**
  13. * Authorization level of a basic admin session
  14. *
  15. * @see _isAllowed()
  16. */
  17. const ADMIN_RESOURCE = 'Magento_Sales::order_statuses';
  18. /**
  19. * Core registry
  20. *
  21. * @var \Magento\Framework\Registry
  22. */
  23. protected $_coreRegistry = null;
  24. /**
  25. * @param \Magento\Backend\App\Action\Context $context
  26. * @param \Magento\Framework\Registry $coreRegistry
  27. */
  28. public function __construct(
  29. \Magento\Backend\App\Action\Context $context,
  30. \Magento\Framework\Registry $coreRegistry
  31. ) {
  32. $this->_coreRegistry = $coreRegistry;
  33. parent::__construct($context);
  34. }
  35. /**
  36. * Initialize status model based on status code in request
  37. *
  38. * @return \Magento\Sales\Model\Order\Status|false
  39. */
  40. protected function _initStatus()
  41. {
  42. $statusCode = $this->getRequest()->getParam('status');
  43. if ($statusCode) {
  44. $status = $this->_objectManager->create(\Magento\Sales\Model\Order\Status::class)->load($statusCode);
  45. } else {
  46. $status = false;
  47. }
  48. return $status;
  49. }
  50. }