Warning: You are browsing the documentation for PrestaShop 8, which is outdated.

You might want to read an updated version of this page for the current version, PrestaShop 9. Read the updated version of this page

Learn how to update to the latest version.

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