1

I am trying to add a configuration tab to the magento admin for my custom module. The problem is that the tab is not showing and no error is given.

this is my acl.xml

 <code>
 <?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn: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="Xlii_Ekomi::config_xlii_ekomi" title="Helloworld Section" sortOrder="80" />
 </resource>
 </resource>
 </resource>
 </resource>
 </resources>
 </acl>
 </config>
 </code>

and this is my system.xml

 <code>
 <?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
 <system>
 <!-- Add new Tab -->
 <tab id="xlii" translate="label" sortOrder="300">
 <label>Darsh Banner</label>
 </tab>
 <section id="xlii_ekomi" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1">
 <label>Helloworld</label>
 <tab>xlii</tab>
 <!-- resource tag name which we have to defined in the acl.xml -->
 <resource>Xlii_Ekomi::config_xlii_ekomi</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>
 </code>
Rajkumar Elumalai
3,6008 gold badges43 silver badges74 bronze badges
asked Sep 9, 2016 at 7:20
3
  • remove var/* or bin/magentp cache:clean and logout admin and login then check it. Commented Sep 9, 2016 at 8:29
  • Thanks for the response! I'm afraid i tried that already. Doesn't seem to have any effect. Commented Sep 9, 2016 at 8:46
  • I update my answer check this Commented Sep 9, 2016 at 9:42

2 Answers 2

5

Check This Code Its Works for me:

 Vendor/<Modulename/
 ├── etc
 │ ├── acl.xml
 │ ├── adminhtml
 │ │ └── system.xml
 │ └── module.xml
 └── registration.php

acl.xml

 <?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn: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">
 <resource id="Vendor_Modulename::config" title="Extension config example" sortOrder="50" />
 </resource>
 </resource>
 </resource>
 </resource>
 </resources>
 </acl>
 </config>

system.xml file:

 <?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
 <system>
 <tab id="example_tab" translate="label" sortOrder="1000">
 <label>Example tab config</label>
 </tab>
 <section id="example_section" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
 <label>Example config section</label>
 <tab>example_tab</tab>
 <resource>Vendor_Modulename::config</resource>
 <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
 <label>General</label>
 <field id="text_example" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
 <label>Text example</label>
 </field>
 <field id="textarea_example" translate="label" type="textarea" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
 <label>Textarea example</label>
 </field>
 </group>
 </section>
 </system>
 </config>

module.xml

 <?xml version="1.0"?>
 <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
 <module name="Vendor_Modulename" setup_version="1.0.0"/>
 </config>

registration.php

 <?php
 \Magento\Framework\Component\ComponentRegistrar::register(
 \Magento\Framework\Component\ComponentRegistrar::MODULE,
 'Vendor_Modulename',
 __DIR__
);

sample answer:

enter image description here

Let me know any problem occur.

answered Sep 9, 2016 at 9:35
0
1

If your Namspace is "Xlii" and Module name is "Ekomi" then try below code otherwise change your namespace and module name appropriate in below code.

Your acl.xml should like this.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
 <acl>
 <resources>
 <resource id="Magento_Adminhtml::admin">
 <resource id="Xlii_Ekomi::module" title="ekomi" sortOrder="80">
 <resource id="Xlii_Ekomi::items" title="ekomi" sortOrder="80" />
 </resource>
 <resource id="Magento_Adminhtml::stores">
 <resource id="Magento_Adminhtml::stores_settings">
 <resource id="Magento_Adminhtml::config">
 </resource>
 </resource>
 </resource>
 </resource>
 </resources>
 </acl>
</config>

And your system.xml is

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
 <system>
 <tab id="ekomi" translate="label" sortOrder="300">
 <label>Darsh Banner</label>
 </tab>
 <section id="ekomi" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1">
 <class>separator-top</class>
 <label>Helloworld</label>
 <tab>ekomi</tab>
 <resource>Xlii_Ekomi::config_ekomi</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>

Hope this will help you.

answered Sep 9, 2016 at 8:55
1
  • Thanks for your response! It doesnt seem to work, i get an "Undefined index" error. The answer below contains the answer, but thanks for helping Commented Sep 9, 2016 at 10:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.