How to create Magento 2 custom system configuration and controller

- Fire development, Magento 2

Magento 2 Development

In Magento 2 menu configurations are located inside menu.xml, so to create custom system configuration and controller you should:


1. Create the menu.xml file in app/code/Webkul/Hello/etc/adminhtml (the tip is based on Webkul’s post):

2. Now, it’s time to clear cache. After you’ve performed this procedure, go to the admin panel, and add a new menu Content -> Webkul Menu.

3. Create the Admin Controller file. Please note that in Magento 2, each action requires a separate file under the Controller/Adminhtml folder. Your file

dubbed Index.php is in app/code/Webkul/Hello/Controller/Adminhtml/Employee:

4. Now, generate a route configuration file, routes.xml, for admin under app/code/Webkul/Hello/etc/adminhtml:


More tips from the Cookbook.