CategoryChoiceTreeType is a child of MaterialChoiceTreeType, it extends parent options
with options listed bellow. It is used to display category tree selection box and requires
Javascript components.
Type options
Option
Type
Default value
Description
choices_tree
array
Array of all available categories
Values to choose from in choices tree
choice_label
string
name
An array key which should be targeted in provided choices list to get the label for input
choice_value
string
id_category
An array key which should be targeted in provided choices list to get the value for input
Required Javascript components
Component
Description
ChoiceTree
Responsible for choice tree expanding and collapsing interactivity
<?php// path/to/your/CustomType.php
usePrestaShopBundle\Form\Admin\Type\CategoryChoiceTreeType;useSymfony\Component\Form\AbstractType;classCustomTypeextendsAbstractType{publicfunctionbuildForm(FormBuilderInterface$builder,array$options){// you can disable some categories selection in choice tree
$disabledCategories=[2,// category id
];$builder->add('category_id',CategoryChoiceTreeType::class,['disabled_values'=>$disabledCategories,]);}}