0 votes
in Magneto by
Explain XML Files

1 Answer

0 votes
by

Several configurations in Magento 2 are all grouped into a specific type of XML file, such as di.xml, which contains all dependency injection configurations, or routes.xml, which contains all URL routes to frontend as well as adminhtml pages.

Some of them are global, such as product_types.xml and webapi.xml, some are area-specific, such as system.xml and menu.xml, and some are both.

etc/ folder

Magento 2 looks for configuration information for each module in its etc directory. The configuration files that you usually have in the module's etc folder are:

acl.xml

config.xml

di.xml

module.xml

webapi.xml

XML Areas

Area is a location of the configuration file within the etc folder, when a file is at a specific location like etc/frontend or etc/adminhtml, all configuration settings from it are applied only during handling that type of request.

The global config files are directly within the etc/ folder, and the area-specific config files are located within the etc folder of the specific area such as etc/frontend.

XML Example

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

     xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">

   <router id="admin">

      <route id="customer" frontName="customer">

         <module name="Magento_Customer" />

      </route>

   </router>

</config>

Here, you can see the route for customer-related admin pages.

To find out whether pages are an admin or not, pay attention to the router ID value, which is the name of the proper router that pairs the request with its handling action.

Here, the route is part of the admin router.

System Config (system.xml)

It is a part of the Magento 2 admin app where you can completely customize how your store behaves, what it looks like, and how it functions.

You can access it from stores -> configurations.

Configuration options are defined in the <Module>/etc/adminhtml/system.xml file.

Related questions

0 votes
asked Nov 9, 2020 in Magneto by sharadyadav1986
0 votes
asked Oct 14, 2022 in Android by AdilsonLima
...