How to get taxonomy term name/label from a field? Ok, so I'm trying to populate a field based on the selection of a taxonomy term. I've mainly got it working thanks to this stack exchange article
use Drupal\taxonomy\Entity;

function module_entity_presave(EntityInterface $entity) {

  if($entity-&gt;bundle() == &quot;node_type&quot;){
    $bread_slice = $entity-&gt;get(&quot;field_taxonomy_term&quot;)-&gt;getString();
    $bread_butter = &quot;- Additional Text for Reasons&quot;;
    $bread_title = $bread_slice.&quot; &quot;.$bread_butter;
    $entity-&gt;field_title-&gt;value = $bread_title;
    //save is done automatically
  }  

}

The issue is that, the resulting code doesn't print the name/label of the term, but instead the tid. So, it ends up showing as &quot;757 - Additional Text for Reasons&quot; I barely know any php, but I know enough to get around. I suppose my issue is the fact I'm not getting the correct value from the taxonomy array, yet I'm unsure how. I've tried finding the correct value using some twig debugging, {{dd(data.taxonomy_term)}} but all the values for it show null. Please point me in the direction of how to solve this?
The field only stores term IDs. So either get the term ID and load the term from it or load the referenced entities directly.
/**
 * Implements hook_entity_presave().
 */
function MYMODULE_entity_presave(\Drupal\Core\Entity\EntityInterface $entity) {

  if ($entity instanceof \Drupal\node\NodeInterface &amp;&amp; $entity-&gt;bundle() === 'MYBUNDLE') {

    if ($field = $entity-&gt;get('field_MYFIELD')) {
    
      if (!$field-&gt;isEmpty()) {

        $label = $field-&gt;referencedEntities()[0]-&gt;label();
        // dpm($label);
        // Code on...
      }
    }
  }
}

Consider installing Devel. It gives you some handy debugging helpers like dpm($some_var) to dump variables into core's status messages block so you can inspect them easily.