Rate this post

 

In this topic, I will guide you How to Add a Custom Template into UI Component Fieldset in Magento 2 in these 5 steps:

  1. Create a form with UI component file
  2. Add a fieldset with code block
  3. Create a file Magestore\InventorySuccess\Block\Adminhtml\Warehouse\Edit\Tab\Stock
  4. Set a template for this block throws a variable
  5. Create a file and implement HTML code to display in the fieldset.

Flexible UI rendering in Magento 2 is possible due to the usage of UI components. By utilizing them, you configure every page of your online store. Moreover, Magento 2 UI components are responsible for supporting interactions of JavaScript components with a server. Acting as modules, Create Form in Magento 2 with UI Component has many useful features for the online store too. In addition, Add a Custom Template into UI Component Fieldset in Magento 2 now have a bit different from Magento 1.   Let ‘s learn about it now.

UI Component Fieldset in Magento 2
UI Component Fieldset in Magento 2

Step 1:

In my module, I created a form with UI component file app/code/Magestore/InventorySuccess/view/adminhtml/ui_component/warehouse_template_form.xml

Step 2:

In this file, I added a fieldset with code block like this:

Step 3:

I created a file Magestore\InventorySuccess\Block\Adminhtml\Warehouse\Edit\Tab\Stock which was extends class \Magento\Backend\Block\Template

Step 4:

In this file I setted a template for this block throw a variable:

Step 5:

I created a file app/code/Magestore/InventorySuccess/view/adminhtml/templates/warehouse/stock.phtml and implement html code to display in the fieldset.

The 5 steps I mention above is the shortest process for you to Add a Custom Template into UI Component Fieldset in Magento 2 . With this guide, you can manage the UI Component Fieldset in Magento 2 easily.

Thank you for reading this post. Good luck to you.

 

Your Magento website needs a powerful Magento ERP for stock control.

DON'T MISS THE CHANCE!

magento erp

How to Insert a New Tab in User Editing Page in Magento 2
How to Use Action of a Grid Backend Magento 2 with Custom Code

Leave a Reply

Your email address will not be published. Required fields are marked *