29.07.2016

Magento 2. Magento Backend. Part III.

Adding configuration parameters

(We need the module that we created in the previous recipes)
 
When you want to save some configuration parameters for your module, you can use the Magento configuration table to save your configuration in it. You can find all the configuration forms under Stores | Configuration in the Magento backend.


 

STEP I – Create the system configuration:

Create the file:

app/code/Magedd/Education/etc/adminhtml/system.xml

STEP II – Create an ACL for the new configuration page:

Create the file:

app/code/Magedd/Education/etc/acl.xml

STEP III – Clean cache by CLI:

 
/var/www/local/{your-project-name.dev} >  php bin/magento cache:clean
 
open Stores | Configuration. If everything went well, you will see the MAGEDD group in the menu. When you click on it, you will see the configuration fields Is Enabled and Header title.
 
When we want to configure a default value for this field, we have to create config.xml.

 

STEP IV – Create default configuration values:

Create the file:

app/code/Magedd/Education/etc/config.xml

STEP V – Clean cache by CLI:

 
/var/www/local/{your-project-name.dev} >  php bin/magento cache:clean
 
Reload the configuration page. You will see that the default values are filled as specified in the config.xml file that we just created.