How to get taxonomy terms of a vocabulary in Drupal 8

Posted by admin on Tue, 12/26/2017 - 13:30

Quick but helpful example - how to get the taxonomy terms of a vocabulary?

$tree = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadTree($vid, $parent = 0, $max_depth = NULL, $load_entities = FALSE);

Where $vid - vocabulary machine name
$parent - parent tid (0 is a default and top level
$max_depth - the maximum depth of the tree
$load_entities - whether load entities or not

×

Hey! Don't miss a new cool stuff!

Comments

Anonymous (not verified)

To some extent this article was definitely helpful to me. best essay writing service were looking for this content, I will make sure to give them the link to this page. Hopefully they will find what they are looking for.

Add new comment