Magento – Add category input to widget.xml

adminmagento2widget

enter image description here

How to add this to my custom widget at backend?

Best Answer

You need to create a category chooser for the Magento Admin Panel:

Backend configurations:

<field id="multi_category_chooser" translate="label" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Categories</label>
<frontend_model>[Vendor]\[Modul]\Block\Adminhtml\Category\Widget\[Chooser]</frontend_model>

Or

$fieldset->addField(
'multi_category_chooser',
'[Vendor]\[Modul]\Block\Adminhtml\Category\Widget\[Chooser]',
[
    'name' => 'multi_category_chooser',
    'label' => __('Categories'),
    'title' => __('Categories'),
    'required' => true
]

);

To Be Continued in below url

Multiple Category Chooser

I hope this will help you.