Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Quote.php
Go to the documentation of this file.
1 <?php
7 
8 abstract class Quote extends \Magento\Backend\App\Action
9 {
15  const ADMIN_RESOURCE = 'Magento_SalesRule::quote';
16 
22  protected $_coreRegistry = null;
23 
27  protected $_fileFactory;
28 
32  protected $_dateFilter;
33 
40  public function __construct(
41  \Magento\Backend\App\Action\Context $context,
42  \Magento\Framework\Registry $coreRegistry,
43  \Magento\Framework\App\Response\Http\FileFactory $fileFactory,
44  \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
45  ) {
46  parent::__construct($context);
47  $this->_coreRegistry = $coreRegistry;
48  $this->_fileFactory = $fileFactory;
49  $this->_dateFilter = $dateFilter;
50  }
51 
57  protected function _initRule()
58  {
59  $this->_coreRegistry->register(
60  \Magento\SalesRule\Model\RegistryConstants::CURRENT_SALES_RULE,
61  $this->_objectManager->create(\Magento\SalesRule\Model\Rule::class)
62  );
63  $id = (int)$this->getRequest()->getParam('id');
64 
65  if (!$id && $this->getRequest()->getParam('rule_id')) {
66  $id = (int)$this->getRequest()->getParam('rule_id');
67  }
68 
69  if ($id) {
70  $this->_coreRegistry->registry(\Magento\SalesRule\Model\RegistryConstants::CURRENT_SALES_RULE)->load($id);
71  }
72  }
73 
79  protected function _initAction()
80  {
81  $this->_view->loadLayout();
82  $this->_setActiveMenu('Magento_SalesRule::promo_quote')->_addBreadcrumb(__('Promotions'), __('Promotions'));
83  return $this;
84  }
85 }
$id
Definition: fieldset.phtml:14
__construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\App\Response\Http\FileFactory $fileFactory, \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter)
Definition: Quote.php:40
__()
Definition: __.php:13