How to determine taxonomy vocabularies related to a specific content type in Drupal 8? could anyone help me please, how to get the vocabularies to a given content type? For example in older Drupal cores there was a taxonomy_get_vocabuleries($type) function(https://api.drupal.org/api/drupal/modules%21taxonomy%21taxonomy.module/function/taxonomy_get_vocabularies/6), but I didn't find anythink similar solution in D8.

Thanks a lot!
In Drupal 6, this was configured per vocabulary, which had settings for which node type they should be displayed.

Since Drupal 7 already, this is handled through fields, a term reference field from a node type to a given vocabulary. The UI doesn't allow it, but a term reference field can also allow terms of multiple vocabularies.

So, if you want to know, you need to load term reference fields of that node type and then filter them by their allowed values setting. That said, the concept of "vocabulary of a given node type" simply doesn't really exist anymore, as there are other ways too, you can for example use an generic entity reference field too for term relationships. (In fact, there was an attempt to replace the term reference field completely in 8.x, but that was not successful so far).

Untested, but you need something like this:

$vids = array();
foreach (\Drupal::entityManager()-&gt;getFieldDefinitions('node', $node_type) as $field_definition) {
  if ($field_definition-&gt;getType() == 'taxonomy_term_reference') {
    foreach ($field_definition-&gt;getSetting('allowed_values') as $allowed_values) {
      $vids[] = $allowed_values['vocabulary'];
    }
  }
}


You can figure out most of this if you look at TaxonomyTermReferenceItem and how it is defining and using it's own settings, for example in getSettableOptions().