2016-09-21 121 views
0

我曾嘗試在系統配置在Magento 2.添加新的領域我已經使用了下面的代碼,但我得到這個錯誤:在系統配置添加自定義字段在Magento 2

Could not create an acl object: Invalid XML in file path/to/file

建議我的正確的方法來做到這一點。提前致謝!!

acl.xml

<?xml version="1.0"?> 
<!-- 
/** 
* Location: magento2_root/app/code/Namespace/Module/etc/acl.xml 
*/ 
--> 
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.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="NAmespace_Module::config" title="Custom Settings" sortOrder="50" /> 
         </resource> 
        </resource> 
       </resource> 
      </resource> 
     </resources> 
    </acl> 

的system.xml

<?xml version="1.0"?> 
<!-- 
/** 
* Location: magento2_root/app/code/Namespace/Module/etc/adminhtml/system.xml 
*/ 
--> 
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> 
    <system> 
     <tab id="settings" translate="label" sortOrder="1000"> 
      <label>Settings</label> 
     </tab> 
     <section id="example_section" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1"> 
      <label>Example config section</label> 
      <tab>settings</tab> 
      <resource>Namespace_Module::config</resource> 
      <group id="general" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> 

       <field id="facebook" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> 
        <label>Facebook</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> 

回答

1

嘗試關閉</config>標籤

<?xml version="1.0"?> 
<!-- 
/** 
* Location: magento2_root/app/code/Namespace/Module/etc/acl.xml 
*/ 
--> 
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.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="NAmespace_Module::config" title="Custom Settings" sortOrder="50" /> 
         </resource> 
        </resource> 
       </resource> 
      </resource> 
     </resources> 
    </acl> 
</config> 
相關問題