Book Image

Magento 2 Development Cookbook

Book Image

Magento 2 Development Cookbook

Overview of this book

With the challenges of growing an online business, Magento 2 is an open source e-commerce platform with innumerable functionalities that gives you the freedom to make on-the-fly decisions. It allows you to customize multiple levels of security permissions and enhance the look and feel of your website, and thus gives you a personalized experience in promoting your business.
Table of Contents (13 chapters)
12
Index

Extending the menu


In the previous recipe, we added a new page to the backend, but it is important that you are able to easily navigate to your custom pages. Not everyone knows the URL, and if the secret keys are enabled for the administrator URLs, it is likely impossible to build a correct URL because you have to know the key.

Getting ready

This recipe builds further on the previous one. Make sure you have the code of the previous recipe installed.

How to do it...

The following steps describe how we can add extra menu items to the Admin menu:

  1. First we have to think about where we will get an extra menu item in the Admin menu. For this tutorial, we will add an extra item in the Marketing menu. For this we need to know the ID of the marketing menu.

  2. Create the file app/code/Packt/HelloWorld/etc/adminhtml/menu.xml with the following content:

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend...