How do I get the value of the Taxonomy Term Description after loading Taxonomy Vocabulary term by Term ID?

cr flag

What would be the best way to render the Taxonomy Vocabulary Term description value? I can render the term id and label/title, but the description seems to need something else that I'm not quite getting.

  // Render ID - working
  $termID = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(419)->id();
  // Render Label/Title - working
  $termLabel = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(419)->label();
  // Not sure how to get the description of the taxonomy term - not working
  $termDescription = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(419)->description();
id flag
In future when you report something is not working, it helps to include information about what occurs.
id flag

The correct method is getDescription.

user108983 avatar
cr flag
This is what I tried also and this doesn't provide a value. Is there an alternate way of writing this that would use getDescription instead? ```$termDescription = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(419)->getDescription();```
user108983 avatar
cr flag
Nevermind.. I'm an idiot. getDescription worked great!

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.