Add.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Tax\Controller\Adminhtml\Rate;
  8. use Magento\Tax\Controller\RegistryConstants;
  9. class Add extends \Magento\Tax\Controller\Adminhtml\Rate
  10. {
  11. /**
  12. * Show Add Form
  13. *
  14. * @return \Magento\Backend\Model\View\Result\Page
  15. */
  16. public function execute()
  17. {
  18. $this->_coreRegistry->register(
  19. RegistryConstants::CURRENT_TAX_RATE_FORM_DATA,
  20. $this->_objectManager->get(\Magento\Backend\Model\Session::class)->getFormData(true)
  21. );
  22. $resultPage = $this->initResultPage();
  23. $layout = $resultPage->getLayout();
  24. $toolbarSaveBlock = $layout->createBlock(\Magento\Tax\Block\Adminhtml\Rate\Toolbar\Save::class)
  25. ->assign('header', __('Add New Tax Rate'))
  26. ->assign('form', $layout->createBlock(\Magento\Tax\Block\Adminhtml\Rate\Form::class, 'tax_rate_form'));
  27. $resultPage->addBreadcrumb(__('Manage Tax Rates'), __('Manage Tax Rates'), $this->getUrl('tax/rate'))
  28. ->addBreadcrumb(__('New Tax Rate'), __('New Tax Rate'))
  29. ->addContent($toolbarSaveBlock);
  30. $resultPage->getConfig()->getTitle()->prepend(__('Tax Zones and Rates'));
  31. $resultPage->getConfig()->getTitle()->prepend(__('New Tax Rate'));
  32. return $resultPage;
  33. }
  34. }