You are here

address-plain.html.twig in Open Social 8

Default template for the 'plain' address formatter.

Available variables:

  • recipient: Recipient.
  • 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.

if a subdivision (dependent_locality, locality, administrative_area) was entered, the array will always have a name. If it's a predefined subdivision, it will also have a code (e.g. 'CA' for California), which is preferred.

File

themes/socialbase/templates/field/address-plain.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default template for the 'plain' address formatter.
  5. *
  6. * Available variables:
  7. * - recipient: Recipient.
  8. * - organization: Organization.
  9. * - address_line1: First address line.
  10. * - address_line2: Second address line.
  11. * - postal_code: Postal code.
  12. * - sorting_code: Sorting code.
  13. * - dependent_locality: The dependent locality.
  14. * - dependent_locality.code: Dependent locality code.
  15. * - dependent_locality.name: Dependent locality name.
  16. * - locality: The locality subdivision.
  17. * - locality.code: Locality code.
  18. * - locality.name: Locality name.
  19. * - administrative_area: The administrative area subdivision.
  20. * - administrative_area.code: Administrative area code.
  21. * - administrative_area.name: Administrative area name.
  22. * - country: The country.
  23. * - country.code: Country code.
  24. * - country.name: Country name.
  25. *
  26. * if a subdivision (dependent_locality, locality, administrative_area) was
  27. * entered, the array will always have a name. If it's a predefined subdivision,
  28. * it will also have a code (e.g. 'CA' for California), which is preferred.
  29. *
  30. * @ingroup themeable
  31. */
  32. #}
  33. {% if recipient %}
  34. {{- recipient -}},
  35. {% endif %}
  36. {% if organization %}
  37. {{- organization -}},
  38. {% endif %}
  39. {% if address_line1 %}
  40. {{- address_line1 -}},
  41. {% endif %}
  42. {% if address_line2 %}
  43. {{- address_line2 -}},
  44. {% endif %}
  45. {% if dependent_locality.name %}
  46. {{- dependent_locality.code ?: dependent_locality.name -}},
  47. {% endif %}
  48. {% if locality.name %}
  49. {{- locality.name -}},
  50. {% elseif locality.code %}
  51. {{- locality.code -}},
  52. {% elseif locality is not iterable %}
  53. {{- locality -}},
  54. {% endif %}
  55. {% if postal_code %}
  56. {{ postal_code }},
  57. {% endif %}
  58. {% if administrative_area.name %}
  59. {{ administrative_area.code ?: administrative_area.name -}},
  60. {% endif %}
  61. {{- country.name -}}