Last active
January 14, 2016 16:34
-
-
Save twosg/8bd92d3fcca0ad1178ea to your computer and use it in GitHub Desktop.
Config XML
This file contains hidden or 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
Required Files: | |
app/code/Vendor/Modulename/etc/adminhtml/system.xml | |
app/code/Vendor/Modulename/etc/acl.xml | |
system.xml: | |
<?xml version="1.0"?> | |
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Config/etc/system_file.xsd"> | |
<system> | |
<!-- Add new Tab --> | |
<tab id="vendor" translate="label" sortOrder="300"> | |
<label>Vendor Extension</label> | |
</tab> | |
<section id="helloworld" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1"> | |
<label>Helloworld</label> | |
<tab>vendor</tab> | |
<!-- resource tag name which we have to defined in the acl.xml --> | |
<resource>Vendor_Helloworld::config_helloworld</resource> | |
</section> | |
<group id="general" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> | |
<label>General Options</label> | |
<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> | |
<label>Enabled</label> | |
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model> | |
</field> | |
</group> | |
</system> | |
</config> | |
acl.xml | |
<?xml version="1.0"?> | |
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Acl/etc/acl.xsd"> | |
<acl> | |
<resources> | |
<resource id="Magento_Backend::admin"> | |
<resource id="Magento_Backend::stores"> | |
<resource id="Magento_Backend::stores_settings"> | |
<resource id="Magento_Config::config"> | |
<!-- this resource id we can use in system.xml for section --> | |
<resource id="Vendor_Helloworld::config_helloworld" title="Helloworld Section" sortOrder="80" /> | |
</resource> | |
</resource> | |
</resource> | |
</resource> | |
</resources> | |
</acl> | |
</config> | |
Source: http://stackoverflow.com/questions/32614392/magento-2-system-xml-in-custom-module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment