PrestaShop Developer Conference
PrestaShop Developer Conference
Paris, France - November 6, 2024
Let's talk code, commerce and open source.

Notice: You are browsing the documentation for PrestaShop 9, which is currently in development.

You might want to read the documentation for the current version, PrestaShop 8. Read the current version of this page

ChoiceCategoriesTreeType

This form class is responsible for creating a category selector using a tree view

Type options

Option Type Default value Description
label boolean false
choices array
list array
valid_list array
multiple boolean true allows multi selection of categories

Required Javascript components

Component Description
../admin-dev/themes/default/js/bundle/category-tree.js Responsible for category tree expanding and collapsing interactivity

Code example

$builder->add('categories', ChoiceCategoriesTreeType::class, [
    'label' => $this->translator->trans('Associated categories', [], 'Admin.Catalog.Feature'),
    'list' => $this->nested_categories,
    'valid_list' => $this->categories,
    'multiple' => true,
])

Preview example

ChoiceCategoriesTreeType rendered in form example