To access taxonomy terms in Drupal 8, you must include the Term class in your project.
use Drupal\taxonomy\Entity\Term;
In order to load the taxonomy, you must send the tid to the term: load function.
$term = Term::load($tid);
The getName function is used to get the name of the taxonomy loaded with the term: load function.
$name = $term->getName();
Finally, the taxonomy term load is done as follows.
use Drupal\taxonomy\Entity\Term;
$term = Term::load($tid);
$name = $term->getName();
Comments
Thanks
Thanks for this beautiful document.
Add new comment