Hello Magento Friends,

Today’s learning subject is How to Call Custom phtml in UI-Component Form in Magento 2?

Magento 2 is a fully customizable platform. The Magento store admin can customize almost anything to increase the performance and user experience of the store. To add some customized code, the admin needs to call a custom phtml file in the UI component in Magento 2.

Let’s get started,

Steps to Call Custom phtml in UI-Component Form in Magento 2:

Step 1: First, we need to create a “category_form.xml” file at the below path.

app\code\Vendor\Extension\view\adminhtml\ui_component\

And, add the code

Step 2: After that, we need to create a “CustomTab.php” file at the below path

app\code\Vendor\Extension\Block\Adminhtml\

And, add the below code

Step 3: After that, create a “custom_tab.phtml” file inside the following path

app\code\Vendor\Extension\view\adminhtml\templates\

And, finally, add the below code.

That’s it. You can check the custom tab is successfully created with content.

custom tab

Conclusion:

Hence, everyone is now clear about How to Call Custom phtml in UI-Component Form in Magento 2. In case of any trouble with the above steps, mention in the comment section and I will be happy to help you. Do share the article further and stay updated.

Happy Reading!

Click to rate this post!
[Total: 5 Average: 3.4]