Hello to Amasty blog readers!
We hope your preparation for Magento 2 certification goes well.
Good news, by the way, another of our team developers Mihail has prepared the answer to the 1.3 topic from the study guide. So, enjoy studying.
Magento 2 configuration files [brief overview]
Magento 2 configuration is divided into separate configuration files. Each of the files (that are also called configuration types) is responsible for its own task and located in the relevant directory.
The configuration files allow you to easily customize a component and are loaded only when Magento accesses the configuration directly.
Read here to learn more about configuration files loading.
Thus, to change the behavior of your module you need to know how to utilize the configuration files.
Magento 2 has several visibility areas:
- Primary configuration (app/etc/di.xml)
- Global configurations from modules (<your component base dir>/<vendorname>/<component-type>-<component-name>/etc/*.xml)
- Area-specific configuration from modules (<your component base dir>/<vendorname>/<component-type>-<component-name>/etc/<area>/*.xml)
In this, number (1) directory is used for bootstrapping Magento; number (2) directory is responsible for collecting and merging certain configuration files from all modules; and number (3) directory gathers and merges configuration files from all modules into the global configuration.
- <your component base dir> is the base directory in which your component is located;
- <vendorname> is the component developer (vendor) name;
- <component-type> is:
- <area> is:
frontend (for store frontend)
adminhtml (for store backend)
webapi_rest (REST API)
webapi_soap (SOAP API)
Configuration files and their utilization
Here is the tree of configuration files:
Below we will take a look at each of the files and their intended use.
This configuration file contains default values for configuration:
The configuration file stores the name and version of the module, as well as its dependencies on other modules:
The configuration file can be used for admin users access setting up by utilizing roles:
The file can be utilized for dependencies injection. It is required for creating plugins and virtual types, as well as for declaring dependencies between classes.
Learn more from here:
The configuration file contains email templates:
The file contains reactions of the observers to the events they are set to watch for:
The file stores API configuration:
The file is utilized to define actions which trigger update section:
The configuration file is utilized for routing setup:
The file can be used for creating settings in Stores>Configuration:
The configuration file is utilized for adding tabs to the Admin Panel:
The file is used for creating cron tasks:
The configuration file stores dynamic information about themes. E.g.: information about the sizes of product images:
That’s all for today. The short notes have been gathered to put you in the way of things. If you need to dig a little deeper, consult the official Magento DevDocs.
We hope this was of service. Share your opinion and drop us a line if you still have questions on the topic.
P.S. Stay tuned and check our next posts in preparation for Magento 2 certification exam!