in magento 2.1 there is user friendly box generated for "Categories" field. enter image description here

I am trying to apply this box for custom field in category form, but without success so far.

I tried to create similar, like in https://github.com/magento/magento2/blob/2.1.0-rc3/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php, but without success. It makes it harder, that form implementation is different between product and category.

XML file for category form https://github.com/magento/magento2/blob/2.1.0-rc3/app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml

XML file for product form https://github.com/magento/magento2/blob/2.1.0-rc3/app/code/Magento/Catalog/view/adminhtml/ui_component/product_form.xml

Someone knows, how to achieve this ?


1 Answer 1


I have the beginning of the anwser. When you create your form, you have to set up a new field type like this:


Then you can use it :

            'name' => 'categories_id',
            'label' => __('Categories'),
            'title' => __('Categories')


And then you will have your categories field! But last issue the rendering is broken because Magento use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Categories to enhance it. I don't know how to use this modifier to apply it on the custom categories field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.