Getting a formatted address component in another field's template I need to pull the administrative area component from an Address field and place the full text of it it in the template of another field on the content type. I've managed to accomplish this with the following code.

In preprocess:

function MYTHEME_preprocess_page_title(&amp;$variables) {
$node = \Drupal::request()-&gt;attributes-&gt;get('node');
  $variables['content_type'] = $node-&gt;bundle();
  if ($node-&gt;bundle() == 'location') {
    $variables['address_state'] = $node-&gt;get('field_address')-&gt;getValue()[0]['administrative_area'];
  }
}


And in the twig template:

{% if content_type == 'location' %}
  &lt;h1{{ title_attributes }}&gt;{% spaceless %}{{ title }}{% endspaceless %}{% spaceless %},{% endspaceless %} {{ address_state }}&lt;/h1&gt;
{% endif %}


This will produce, for example "Boston, MA". But what I want is "Boston, Massachusetts", using the full name of the administrative area rather than the code. According to Drupal Commerce Address docs, you can get the full name in a twig template using {{ administrative_area.name }}. But I couldn't get that to work. How can I render the full administrative area name in the template?
How I understand the linked doc you need to configure the plain address formatter in a view mode to use address-plain.html.twig. Then you can output the node field as formatted in this twig:

   if ($node-&gt;bundle() == 'location') {
     $variables['address_state'] = $node-&gt;get('field_address')-&gt;view('custom_view_mode');
   }