Skip to content

[UX Autocomplete] setting "tom_select_options" overrides some default values set by ux which breaks plugin #2002

Open
@sabat24

Description

@sabat24

Tested on 2.10.

When creating FormType:

  1. Set autocomplete_url to some custom url.
  2. Set some custom plugin you want to add via tom_select_options
$builder->add('field', ChoiceType::class, [
                'choices' => [
                    'Select something' => '',
                ],
                'autocomplete' => true,
                'autocomplete_url' => 'custom_url,
                'tom_select_options' => [
                    'plugins' => ['dropdown_input'],
                ]
            ]);
  1. On site open select to choose something and you will get an error in console from ux-autocomplete controller

Uncaught TypeError: this.getUrl is not a function

The error is caused because of that ux-autocomplete controller adds virtual_scroll as a plugin by default when url option is set. However providing plugins option directly overrides it. Knowing that fact I can set of course it manually

'tom_select_options' => [
    'plugins' => ['dropdown_input', 'virtual_scroll'],
]

It would be nice if some required default options were merged instead of replacing them. Or at least there may be some information in doc what kind of options should be set to not override those created by ux-autocomplete controller.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions