6

In the previous version of Drupal, it was possible to reference taxonomy tags in Drupal's forms using the following option:

'#autocomplete_path' => 'taxonomy/autocomplete/'.$vid,

However, in the Drupal 8, taxonomy term reference field has been removed in favor of Entity reference, more info here.

So, is there any alternative available?

9

Well, I have found the way in the change records. take a look at: https://www.drupal.org/node/2418529

Here is the example options for taxonomy fields:

'#type' => 'entity_autocomplete',
'#target_type' => 'taxonomy_term',
'#selection_settings' => [
  'target_bundles' => array($vid1, $vid2),
],

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.