get('\Psr\Log\LoggerInterface'); $this->_logger = $logger; $base = new Base; $this->_apiUrl = $base->_apiUrl; $this->_apiKey = $base->_apiKey; $this->_systemStore = $systemStore; $this->_formFactory = $formFactory; } public function render(AbstractElement $element) { $values = $element->getValues(); $html = ''; if((!empty($this->_apiUrl))&&(!empty($this->_apiKey))){ $manager = \Magento\Framework\App\ObjectManager::getInstance(); $obj = $manager->create('Magento\Sales\Model\ResourceModel\Order\Status\Collection'); $statuses = $obj->toOptionArray(); $client = new \Retailcrm\Retailcrm\Model\ApiClient\ApiClient($this->_apiUrl,$this->_apiKey); try { $response = $client->statusesList(); if ($response->isSuccessful()&&200 === $response->getStatusCode()) { $statusTypes = $response['statuses']; } } catch (Retailcrm\Retailcrm\Model\ApiClient\Exception\CurlException $e) { $this->_logger->addDebug($e->getMessage()); } $config = \Magento\Framework\App\ObjectManager::getInstance()->get( 'Magento\Framework\App\Config\ScopeConfigInterface' ); foreach ($statuses as $k => $status){ $html .=''; $html .=''; $html .=''; $html .=''; $html .=''; $html .='
'.$status['label'].''; $html .=''; $html .='
'; } return $html; }else{ $html = '
Please check your API Url & API Key
'; return $html; } } }