0

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?

0

I'm not sure if it would integrate with that widget automatically, but I really like Chosen. Doesn't work on mobile though.

| improve this answer | |
0

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';
    }
  }

  return $form;
}

This is the result:

screenshot

Hope this helps someone.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.