For T31398, we need a form field type that allows multiple selections and has a searchable dropdown of valid values. While HTMLMultiSelectField does all of that, it's backed by a list of html checkboxes, and so doesn't preserve the order of selected values. Order is important for the list of pages in a gadget as it defines the sequence in which JS sources are concatenated, and in case of packaged gadgets the first selected page is used as the entry point.
The newly added MenuTagMultiselectWidget (in T380995, cc @Func @Daimona) also uses checkbox list, deviating from the behaviour of the parent class TagMultiselectWidget which uses a textarea (value represented as a newline-delimited string).
Approach 1
- Implement a parameter in MenuTagMutliselectWidget so that it can be backed by either a checkbox list or a textarea.
- Add a HTMLMenuTagMultiSelectField class which uses MenuTagMutliselectWidget with that parameter set.
- Enable use of type => 'menutagmultiselect' in HTMLForm fields.
Approach 2
- Switch MenuTagMultiselectWidget to always use a textarea.
- Fix HTMLMultiSelectField loadDataFromRequest() accordingly.