Custom layout for a field in Drupal 7 with using a term id and term name
After looking at https://www.digett.com/insights/change-output-single-field-drupal-7-node I realised that you can use $variables['element']['#items']

term id
$variables['element']['#items']['0']['tid']

term name
$variables['element']['#items']['0']['taxonomy_term']-&gt;name