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 (18 chapters)
Magento 2 Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with backend components


The Magento backend exists with a lot of reusable components, such as a button, menus, forms, and more. When creating backend extensions, you can use these components to build you custom pages. In this recipe, we will create a page where we can play with the components available .

Getting ready

We will extend the existing Packt_HelloWorld module with a new page where we can play with the backend components.

How to do it...

In the following steps, we will create a page that uses some backend components:

  1. We will make some tests in a new controller action. Create a file app/code/Packt/HelloWorld/Controller/Adminhtml/Component/Index.php with the following content:

    <?php
    namespace Packt\HelloWorld\Controller\Adminhtml\Component;
    
    use Magento\Backend\App\Action\Context;
    use Magento\Framework\View\Result\PageFactory;
    
    class Index extends \Magento\Backend\App\Action
    {
        protected $resultPageFactory;
    
        public function __construct(
            Context $context,
        ...