Drupal 8 Taxonomy Term Load

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

Submitted byKonuk (not verified)on Mon, 10/12/2018 - 22:12

Thanks for this beautiful document.

Add new comment

Kısıtlı HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.