getnet-adquirencia /
sub-seller-magento
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Copyright © Getnet. All rights reserved. |
||
| 4 | * |
||
| 5 | * @author Bruno Elisei <[email protected]> |
||
| 6 | * See LICENSE for license details. |
||
| 7 | */ |
||
| 8 | |||
| 9 | namespace Getnet\SubSellerMagento\Controller\Adminhtml; |
||
| 10 | |||
| 11 | use Magento\Framework\Controller\ResultFactory; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Adminhtml sub seller controller. |
||
| 15 | */ |
||
| 16 | abstract class Subseller extends \Magento\Backend\App\Action |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * Authorization level of a basic admin session. |
||
| 20 | * |
||
| 21 | * @see _isAllowed() |
||
| 22 | */ |
||
| 23 | public const ADMIN_RESOURCE = 'Getnet_SubSellerMagento::manage_subseller'; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var \Magento\Framework\Registry |
||
| 27 | */ |
||
| 28 | protected $_coreRegistry; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var \Getnet\SubSellerMagento\Api\SubSellerRepositoryInterface |
||
| 32 | */ |
||
| 33 | protected $_subSellerRepository; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var \Getnet\SubSellerMagento\Model\Seller\Converter |
||
| 37 | */ |
||
| 38 | protected $subSellerConverter; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param \Magento\Backend\App\Action\Context $context |
||
| 42 | * @param \Magento\Framework\Registry $coreRegistry |
||
| 43 | * @param \Getnet\SubSellerMagento\Api\SubSellerRepositoryInterface $subSellerRepository |
||
| 44 | * @param \Getnet\SubSellerMagento\Model\Seller\Converter $subSellerConverter |
||
| 45 | */ |
||
| 46 | public function __construct( |
||
| 47 | \Magento\Backend\App\Action\Context $context, |
||
| 48 | \Magento\Framework\Registry $coreRegistry, |
||
| 49 | \Getnet\SubSellerMagento\Api\SubSellerRepositoryInterface $subSellerRepository, |
||
| 50 | \Getnet\SubSellerMagento\Model\Seller\Converter $subSellerConverter |
||
| 51 | ) { |
||
| 52 | $this->_coreRegistry = $coreRegistry; |
||
| 53 | $this->_subSellerRepository = $subSellerRepository; |
||
| 54 | $this->subSellerConverter = $subSellerConverter; |
||
| 55 | parent::__construct($context); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Validate/Filter Sub Seller Data. |
||
| 60 | * |
||
| 61 | * @param array $subSellerData |
||
| 62 | * |
||
| 63 | * @return array |
||
| 64 | */ |
||
| 65 | protected function _processSubSellerData($subSellerData) |
||
| 66 | { |
||
| 67 | $result = []; |
||
| 68 | foreach ($subSellerData as $key => $value) { |
||
| 69 | if (is_array($value)) { |
||
| 70 | $result[$key] = $this->_processSubSellerData($value); |
||
| 71 | } else { |
||
| 72 | $result[$key] = $value; |
||
| 73 | } |
||
| 74 | } |
||
| 75 | |||
| 76 | return $result; |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * Initialize action. |
||
| 81 | * |
||
| 82 | * @return \Magento\Backend\Model\View\Result\Page |
||
| 83 | */ |
||
| 84 | protected function initResultPage() |
||
| 85 | { |
||
| 86 | $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); |
||
| 87 | $resultPage->setActiveMenu('Getnet_SubSellerMagento::subseller_manager') |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 88 | ->addBreadcrumb(__('Getnet'), __('Getnet')) |
||
| 89 | ->addBreadcrumb(__('SubSeller'), __('Sub Seller')); |
||
| 90 | |||
| 91 | return $resultPage; |
||
| 92 | } |
||
| 93 | } |
||
| 94 |