-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
55 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,37 +18,37 @@ class Extensions extends \Magento\Config\Block\System\Config\Form\Fieldset | |
* @var \Magento\Framework\Module\ModuleListInterface | ||
*/ | ||
protected $_moduleList; | ||
|
||
/** | ||
* @var \Magento\Framework\View\LayoutFactory | ||
*/ | ||
protected $_layoutFactory; | ||
|
||
/** | ||
* @var \Magento\Framework\Module\Dir\Reader | ||
*/ | ||
protected $_moduleReader; | ||
|
||
/** | ||
* @var DecoderInterface | ||
*/ | ||
protected $_jsonDecoder; | ||
|
||
/** | ||
* @var \Magento\Framework\Filesystem\Driver\File | ||
*/ | ||
protected $_filesystem; | ||
|
||
/** | ||
* @var \Mygento\Base\Helper\Module | ||
*/ | ||
protected $_moduleHelper; | ||
|
||
/** | ||
* @var \Magento\Store\Api\Data\StoreInterface | ||
*/ | ||
protected $_store; | ||
|
||
/** | ||
* | ||
* @param \Magento\Backend\Block\Context $context | ||
|
@@ -79,7 +79,7 @@ public function __construct( | |
array $data = [] | ||
) { | ||
parent::__construct($context, $authSession, $jsHelper, $data); | ||
|
||
$this->_moduleList = $moduleList; | ||
$this->_layoutFactory = $layoutFactory; | ||
$this->_moduleReader = $moduleReader; | ||
|
@@ -89,7 +89,7 @@ public function __construct( | |
$this->_store = $store; | ||
$this->_scopeConfig = $context->getScopeConfig(); | ||
} | ||
|
||
/** | ||
* Render fieldset html | ||
* | ||
|
@@ -99,15 +99,15 @@ public function __construct( | |
public function render(AbstractElement $element) | ||
{ | ||
$html = $this->_getHeaderHtml($element); | ||
|
||
$site = 'https://www.mygento.net'; | ||
$email = '[email protected]'; | ||
|
||
if ($this->_store->getLocaleCode() == 'ru_RU') { | ||
$site = 'https://www.mygento.ru'; | ||
$email = '[email protected]'; | ||
} | ||
|
||
$ticketUrl = "mailto:[email protected]"; | ||
$url = __( | ||
'Purchased extensions support is available through ' | ||
|
@@ -127,7 +127,7 @@ public function render(AbstractElement $element) | |
); | ||
$tender = __('Tender offer can be checked ' | ||
. '<a href="https://www.mygento.ru/oferta" target="_blank">here</a>'); | ||
|
||
$html .= '<table class="mygento-info" cellspacing="0" cellpading="0">' | ||
. '<tr class="mygento-info-line">'; | ||
$html .= '<tr><td>' . __('Support') . ':</td>' . | ||
|
@@ -142,12 +142,12 @@ public function render(AbstractElement $element) | |
$site . '/services' | ||
) . '</td></tr><tr class="mygento-info-line"></tr>'; | ||
$html .= '</table>'; | ||
|
||
$modules = $this->_moduleList->getNames(); | ||
|
||
$dispatchResult = new \Magento\Framework\DataObject($modules); | ||
$modules = $dispatchResult->toArray(); | ||
|
||
$html .= '<h2>' . __('Installed Extensions') . '</h2>'; | ||
$html .= '<ul class="mygento-mod-list">'; | ||
sort($modules); | ||
|
@@ -157,32 +157,32 @@ public function render(AbstractElement $element) | |
) { | ||
continue; | ||
} | ||
|
||
$html .= $this->_getFieldHtml($element, $moduleName); | ||
} | ||
$html .= '</ul>'; | ||
|
||
$html .= $this->_getFooterHtml($element); | ||
|
||
return $html; | ||
} | ||
|
||
/** | ||
* @return \Magento\Framework\View\Element\BlockInterface | ||
*/ | ||
protected function _getFieldRenderer() | ||
{ | ||
if (empty($this->_fieldRenderer)) { | ||
$layout = $this->_layoutFactory->create(); | ||
|
||
$this->_fieldRenderer = $layout->createBlock( | ||
\Magento\Config\Block\System\Config\Form\Field::class | ||
'Magento\Config\Block\System\Config\Form\Field' | ||
); | ||
} | ||
|
||
return $this->_fieldRenderer; | ||
} | ||
|
||
/** | ||
* Read info about extension from composer json file | ||
* @param $moduleCode | ||
|
@@ -193,13 +193,13 @@ protected function _getModuleInfo($moduleCode) | |
{ | ||
$dir = $this->_moduleReader->getModuleDir('', $moduleCode); | ||
$file = $dir . DIRECTORY_SEPARATOR . 'composer.json'; | ||
|
||
$string = $this->_filesystem->fileGetContents($file); | ||
$json = $this->_jsonDecoder->decode($string); | ||
|
||
return $json; | ||
} | ||
|
||
/** | ||
* @param $fieldset | ||
* @param $moduleCode | ||
|
@@ -214,22 +214,22 @@ protected function _getFieldHtml($fieldset, $moduleCode) | |
) { | ||
return ''; | ||
} | ||
|
||
$currentVer = $module['version']; | ||
$moduleName = $module['description']; | ||
$status = '<span class="mygento-icon-success"></span>'; | ||
|
||
// in case if module output disabled | ||
if ($this->_scopeConfig->getValue('advanced/modules_disable_output/' . $moduleCode)) { | ||
$status = __('Output disabled'); | ||
} | ||
|
||
$field = $fieldset->addField($moduleCode, 'label', [ | ||
'name' => 'dummy', | ||
'label' => $moduleName, | ||
'value' => $currentVer, | ||
])->setRenderer($this->_getFieldRenderer()); | ||
|
||
return '<li>' . $status . $field->toHtml() . '</li>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ public function __construct( | |
$this->urlBuilder = $urlBuilder; | ||
} | ||
|
||
|
||
/** | ||
* Prepare Data Source | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters