Skip to content

Commit

Permalink
Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dholi committed Oct 1, 2021
1 parent cb3163a commit be63bc8
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 62 deletions.
26 changes: 26 additions & 0 deletions src/module-bling/Block/Adminhtml/System/Config/Documentation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
*
* Bling para Magento 2
*
* @category elOOm
* @package Modulo Bling
* @copyright Copyright (c) 2021 elOOm (https://eloom.tech)
* @version 1.0.0
* @license https://opensource.org/licenses/OSL-3.0
* @license https://opensource.org/licenses/AFL-3.0
*
*/
declare(strict_types=1);

namespace Eloom\Bling\Block\Adminhtml\System\Config;

use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\Data\Form\Element\AbstractElement;

class Documentation extends Field {

protected function _getElementHtml(AbstractElement $element) {
return '<a href="https://docs.eloom.tech/bling/" target="_blank">' . __('Documentation') . '</a>';
}
}
59 changes: 0 additions & 59 deletions src/module-bling/Block/Adminhtml/System/Config/Information.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
*
* Bling para Magento 2
*
* @category elOOm
* @package Modulo Bling
* @copyright Copyright (c) 2021 elOOm (https://eloom.tech)
* @version 1.0.0
* @license https://opensource.org/licenses/OSL-3.0
* @license https://opensource.org/licenses/AFL-3.0
*
*/
declare(strict_types=1);

namespace Eloom\Bling\Block\Adminhtml\System\Config;

use Magento\Config\Block\System\Config\Form\Field;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Module\ModuleResource;

class InstalledVersion extends Field {

protected function _getElementHtml(AbstractElement $element) {
$objectManager = ObjectManager::getInstance();
$moduleResource = $objectManager->create(ModuleResource::class);

$dbVersion = (string)$moduleResource->getDbVersion('Eloom_Bling');

$element->setValue($dbVersion);

return '<strong>' . $element->getEscapedValue() . '</strong> - [<a href="https://github.com/eloom/module-bling/releases" target="_blank">' . __('Releases') . '</a>]';
}
}
14 changes: 11 additions & 3 deletions src/module-bling/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@
<tab>eloom</tab>
<resource>Eloom_Bling::config</resource>

<group id="information" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<group id="information" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Information</label>
<frontend_model>Eloom\Bling\Block\Adminhtml\System\Config\Information</frontend_model>

<field id="version" translate="label" type="label" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Installed version</label>
<frontend_model>Eloom\Bling\Block\Adminhtml\System\Config\InstalledVersion</frontend_model>
</field>

<field id="docs" translate="label" type="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Documentation</label>
<frontend_model>Eloom\Bling\Block\Adminhtml\System\Config\Documentation</frontend_model>
</field>
</group>

<group id="general" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
Expand Down

0 comments on commit be63bc8

Please sign in to comment.