Registering a backend controller
The first thing that we will learn is how to extend the backend with a custom controller action. We need a controller that is secured so that only logged-in backend users can see the contents of this page.
A backend controller is required when you want to add an extra page to the backend of Magento. This is mostly the case when you are working with a custom form or overview that you need for your module.
Getting ready
For development purposes, it is recommended that we remove the secret key (the hash in the URL) from the admin URLs. You can configure this in Stores | Configuration | Advanced | Admin | Security. Change the configuration as shown in the following screenshot:
How to do it...
When you want to add an extra page to your backend, you have to follow these steps:
Create the file
routes.xml
in the folderapp/code/Packt/HelloWorld/etc/adminhtml
with the following content:<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance...