Get custom fields assigned to taxonomy How to get custom fields assigned to taxonomy in Drupal 8. 
What I have done so far is:

$contact_countries = \Drupal::service('entity_type.manager')-&gt;getStorage("taxonomy_term")-&gt;loadTree('contact_country');


$contact_countries now holds taxonomies, I can get name of taxonomy and ID, but I also created custom field in taxonomy, how can I get it? 

With this code

foreach($contact_countries as $contact_countrie) {
        $terms[] = \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term')-&gt;load($contact_countrie-&gt;tid);
        $variables['contact_countries'] = $terms;
    }


I'm getting object(Drupal\taxonomy\Entity\Term) with protected values. I can see my custom fields values there but can't access it.
I done it like this: 

$contact_countries = \Drupal::service('entity_type.manager')-&gt;getStorage("taxonomy_term")-&gt;loadTree('contact_country');

$terms = array();

foreach($contact_countries as $contact_countrie) {
    $terms[] = array(
        'contact_country' =&gt; $contact_countrie-&gt;name,
        'contact_phone' =&gt; \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term')-&gt;load($contact_countrie-&gt;tid)-&gt;get('field_phone')-&gt;getValue()[0]['value'],
        'contact_flag' =&gt; \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term')-&gt;load($contact_countrie-&gt;tid)-&gt;get('field_category_flag')-&gt;entity-&gt;uri-&gt;value,
    );
}


Here I have fields field_phone (text field) and field_category_flag (file field).