I'd like to create many extensions using the same tab like this sample on the image below, what I need to do in each extension to keep at the same tab?
Stores > Settings > Configuration
Rafael,
Pretty straight forward just use a consistent <tab></tab>
in the system configuration between the extensions. For example:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../Backend/etc/system_file.xsd">
<system>
<tab id="company" translate="label" sortOrder="100">
<label>My Company Name</label>
</tab>
... here you enter sections and fields etc ...
</system>
</config>
As asked the ACL would be something as follows, please note that the Tab is not actually referenced.
<?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">
<resource id="Company_Modulename::system_config"
title="Some Great Name" />
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
Magento by default won't show the tab if the user has no privileges to modules under it.
In the system.xml
file of your extension you can put a section (free gift in your example) under any tab just by adding a child node to the <section>
node called <tab>
and the value of it should be an id of an existing tab.
Here is an example from the core: https://github.com/magento/magento2/blob/develop/app/code/Magento/Sales/etc/adminhtml/system.xml#L16 and the tab declaration: https://github.com/magento/magento2/blob/develop/app/code/Magento/Sales/etc/adminhtml/system.xml#L10