How to access taxonomy term field? I added two fields to my vocabulary terms field management. How do I get these values? There is no fields like color or Image in my Taxonomy Term vocabulary dump.

How does Drupal 8 store these additional fields?



$terms = $this-&gt;taxonomyStorage-&gt;loadTree($vocabularyName);

//CAN ACCESS
$terms[0]-&gt;name

//CAN'T ACCESS
$terms[0]-&gt;color
Its similar to any other entity on Drupal 8

$name = $terms[0]-&gt;name;

//simple text field
$color = $terms[0]-&gt;field_color-&gt;value;

//multivalue field - get array of values
$color = $terms[0]-&gt;get('field_color')-&gt;getValue();

//entity reference field
$entity = $terms[0]-&gt;field_color-&gt;entity;

//image field 
$image = $terms[0]-&gt;get('field_image')-&gt;entity;
$image_uri = $image-&gt;getFileUri();

//get color entity id
$entity_id = $entity-&gt;id();


I think at least your color field is actually an entity reference