3

I have followed below link and created both "system.xml" and "acl.xml" at their respective locations.

https://stackoverflow.com/questions/32614392/magento-2-system-xml-in-custom-module

But instead of creating a custom system config tab and setting for this module, it gives error as following in a report generated:

a:4:{i:0;s:138:"Notice: Undefined index: id in /var/www/html/magento-2/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php on line 59";i:1;s:6805:"#0 /var/www/html/magento-2/vendor/magento/module-config/Model/Config/Structure/Element/Iterator.php(59): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...', '/var/www/html/m...', 59, Array)

Anyone can clarify what could be the issue?

/Darsh/Banner/etc/adminhtml/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="darsh" translate="label" sortOrder="300">
 <label>Darsh Banner</label>
 </tab>
 <section id="darsh_banner" translate="label" type="text" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="1">
 <label>Helloworld</label>
 <tab>darsh_banner</tab>
 <!-- resource tag name which we have to defined in the acl.xml -->
 <resource>Darsh_Banner::config_darsh_banner</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>

and /Darsh/Banner/etc/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="Darsh_Banner::config_darsh_banner" title="Helloworld Section" sortOrder="80" />
 </resource>
 </resource>
 </resource>
 </resource>
 </resources>
 </acl>
</config>
asked Dec 7, 2015 at 10:28
0

1 Answer 1

7

First mistake is .xsd file configuration, In magento 2 stable release it should be

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">

and second mistake is section should be darsh instead of darsh_banner

third mistake is

<tab>darsh_banner</tab> It should be

<tab>darsh</tab>
answered Dec 7, 2015 at 10:53
1
  • 1
    And the namespace schema location for the acl.xml should be urn:magento:framework:Acl/etc/acl.xsd Commented Dec 15, 2015 at 22:31

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.