address-plain.html.twig in Address 8
Default template for the 'plain' address formatter.
Available variables:
- given_name: Given name.
- additional_name: Additional name.
- family_name: Family name.
- organization: Organization.
- address_line1: First address line.
- address_line2: Second address line.
- postal_code: Postal code.
- sorting_code: Sorting code.
- dependent_locality: The dependent locality.
- dependent_locality.code: Dependent locality code.
- dependent_locality.name: Dependent locality name.
- locality: The locality subdivision.
- locality.code: Locality code.
- locality.name: Locality name.
- administrative_area: The administrative area subdivision.
- administrative_area.code: Administrative area code.
- administrative_area.name: Administrative area name.
- country: The country.
- country.code: Country code.
- country.name: Country name.
- address: An object that implements \Drupal\address\AddressInterface representing the address to be rendered. Only public methods can be used.
- view_mode: View mode of the entity being rendered that this address field is attached to. For example, "teaser" or "full".
if a subdivision (dependent_locality, locality, administrative_area) was entered, the array will always have a code. If it's a predefined subdivision, it will also have a name. The code is always preferred.
1 theme call to address-plain.html.twig
- AddressPlainFormatter::viewElement in src/
Plugin/ Field/ FieldFormatter/ AddressPlainFormatter.php - Builds a renderable array for a single address item.
File
templates/address-plain.html.twigView source
- {#
- /**
- * @file
- * Default template for the 'plain' address formatter.
- *
- * Available variables:
- * - given_name: Given name.
- * - additional_name: Additional name.
- * - family_name: Family name.
- * - organization: Organization.
- * - address_line1: First address line.
- * - address_line2: Second address line.
- * - postal_code: Postal code.
- * - sorting_code: Sorting code.
- * - dependent_locality: The dependent locality.
- * - dependent_locality.code: Dependent locality code.
- * - dependent_locality.name: Dependent locality name.
- * - locality: The locality subdivision.
- * - locality.code: Locality code.
- * - locality.name: Locality name.
- * - administrative_area: The administrative area subdivision.
- * - administrative_area.code: Administrative area code.
- * - administrative_area.name: Administrative area name.
- * - country: The country.
- * - country.code: Country code.
- * - country.name: Country name.
- * - address: An object that implements \Drupal\address\AddressInterface
- * representing the address to be rendered. Only public methods can be used.
- * - view_mode: View mode of the entity being rendered that this address field
- * is attached to. For example, "teaser" or "full".
- *
- * if a subdivision (dependent_locality, locality, administrative_area) was
- * entered, the array will always have a code. If it's a predefined subdivision,
- * it will also have a name. The code is always preferred.
- *
- * @ingroup themeable
- */
- #}
- <p class="address" translate="no">
- {% if given_name or family_name %}
- {{ given_name }} {{ family_name }} <br>
- {% endif %}
- {% if organization %}
- {{ organization }} <br>
- {% endif %}
- {% if address_line1 %}
- {{ address_line1 }} <br>
- {% endif %}
- {% if address_line2 %}
- {{ address_line2 }} <br>
- {% endif %}
- {% if dependent_locality.code %}
- {{ dependent_locality.code }} <br>
- {% endif %}
- {% if locality.code or postal_code or administrative_area.code %}
- {{ locality.code }} {{ postal_code }} {{ administrative_area.code }} <br>
- {% endif %}
- {{ country.name }}
- </p>