I have a huge hierarchical vocabulary of terms and adding a new child to a specific term can be hard using the default multi-value select list widget.
Can I use an autocomplete widget or -better- an entity browser instead?
Solved myself using Select2 contrib module + very little customization in my module:
function my_module_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if ($form_id == 'taxonomy_term_myvocabulary_form') {
// Show parent select as select2 (if enabled)
if (\Drupal::moduleHandler()->moduleExists('select2')) {
$form['relations']['parent']['#type'] = 'select2';
}
}
}
This is the result:
Hope this helps someone.
I'm not sure if it would integrate with that widget automatically, but I really like Chosen. Doesn't work on mobile though.