Skip to content

Commit f007391

Browse files
committed
Added info + system xml templates
1 parent 8c508aa commit f007391

File tree

4 files changed

+83
-2
lines changed

4 files changed

+83
-2
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
/**
3+
* Copyright © Magefan ([email protected]). All rights reserved.
4+
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
5+
*/
6+
7+
namespace Magefan\Community\Block\Adminhtml\System\Config\Form;
8+
9+
use Magento\Store\Model\ScopeInterface;
10+
11+
/**
12+
* Admin Magefan configurations information block
13+
*/
14+
class Info extends \Magento\Config\Block\System\Config\Form\Field
15+
{
16+
/**
17+
* @var \Magento\Framework\Module\ModuleListInterface
18+
*/
19+
protected $moduleList;
20+
21+
/**
22+
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
23+
* @param \Magento\Backend\Block\Template\Context $context
24+
* @param array $data
25+
*/
26+
public function __construct(
27+
\Magento\Framework\Module\ModuleListInterface $moduleList,
28+
\Magento\Backend\Block\Template\Context $context,
29+
array $data = []
30+
) {
31+
parent::__construct($context, $data);
32+
$this->moduleList = $moduleList;
33+
}
34+
35+
/**
36+
* Return info block html
37+
* @param \Magento\Framework\Data\Form\Element\AbstractElement $element
38+
* @return string
39+
*/
40+
public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
41+
{
42+
$m = $this->moduleList->getOne($this->getModuleName());
43+
$html = '<div style="padding:10px;background-color:#f8f8f8;border:1px solid #ddd;margin-bottom:7px;">
44+
' . $this->getModuleTitle() . ' v' . $m['setup_version'] . ' was developed by <a href="' . $this->getModuleUrl() . '" target="_blank">Magefan</a>.
45+
</div>';
46+
47+
return $html;
48+
}
49+
50+
/**
51+
* Return extension url
52+
* @return string
53+
*/
54+
protected function getModuleUrl()
55+
{
56+
return 'https://magefan.com/';
57+
}
58+
59+
/**
60+
* Return extension title
61+
* @return string
62+
*/
63+
protected function getModuleTitle()
64+
{
65+
return ucwords(str_replace('_', ' ', $this->getModuleName())) . ' Extension';
66+
}
67+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"OSL-3.0",
99
"AFL-3.0"
1010
],
11-
"version": "2.0.0",
11+
"version": "2.0.1",
1212
"type": "magento2-module",
1313
"autoload": {
1414
"files": [

etc/adminhtml/system.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © Magefan ([email protected]). All rights reserved.
5+
* See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
9+
<system>
10+
<tab id="magefan" sortOrder="110" translate="label">
11+
<label>Magefan Extensions</label>
12+
</tab>
13+
</system>
14+
</config>

etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magefan_Community" setup_version="2.0.0"/>
9+
<module name="Magefan_Community" setup_version="2.0.1"/>
1010
</config>

0 commit comments

Comments
 (0)