![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/extmag/shiplab/Model/Label/Manual/ |
<?php /** * Copyright © Extmag. All rights reserved. */ namespace Extmag\Shiplab\Model\Label\Manual; use Exception; use Extmag\Shiplab\Helper\DataPrepareFactory; use Magento\Framework\Api\Filter; use Magento\Framework\App\RequestInterface; use Magento\Ui\DataProvider\Modifier\PoolInterface; use Magento\Ui\DataProvider\ModifierPoolDataProvider; class DataProvider extends ModifierPoolDataProvider { /** * @var array */ protected $loadedData; /** * @var string */ protected $carrierCode; /** * @var DataPrepareFactory */ protected $dataPrepare; /** * @param string $name * @param string $primaryFieldName * @param string $requestFieldName * @param array $meta * @param array $data * @param PoolInterface|null $pool * @param DataPrepareFactory $dataPrepare * @param RequestInterface $request * @throws Exception */ public function __construct( $name, $primaryFieldName, $requestFieldName, DataPrepareFactory $dataPrepare, RequestInterface $request, array $meta = [], array $data = [], PoolInterface $pool = null ) { parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool); $this->meta = $this->prepareMeta($this->meta); $this->carrierCode = $request->getParam('carrier_code'); $this->dataPrepare = $dataPrepare->get($this->carrierCode); } /** * Prepares Meta * * @param array $meta * @return array */ public function prepareMeta(array $meta) { return $meta; } /** * Get data * * @return array */ public function getData() { if (isset($this->loadedData)) { return $this->loadedData; } $this->loadedData = $this->dataPrepare->getData(); if (!empty($this->loadedData['rate_error']) && is_array($this->loadedData['rate_error'])) { $this->loadedData['rate_error'] = implode("<br>", $this->loadedData['rate_error']); } return [null => $this->loadedData]; } /** * @param Filter $filter * @return mixed|void|null */ public function addFilter(Filter $filter) { return null; } }