{# Template to render an address OPTIONS * render string ['list'|'bloc'|'inline'] * with_valid_from bool start date * with_valid_to bool end date * with_picto bool add a forkawesome pictogram * with_delimiter bool add a delimiter between fragments * has_no_address bool * multiline bool multiline display * extended_infos bool add extra informations (step, floor, etc.) #} {% macro raw(address, options) %} {% if address.street is not empty %}

{{ address.street }} {% if address.streetNumber is not empty %} {{ address.streetNumber }} {% endif %}

{% endif %} {% if options['extended_infos'] %} {{ _self.extended(address, options) }} {% endif %} {% if address.postCode is not empty %}

{{ address.postCode.code }} {{ address.postCode.name }}

{{ address.postCode.country.name|localize_translatable_string }}

{% endif %} {% endmacro %} {% macro extended(address, options) %} {% if address.floor is not empty %} {{ 'address more.floor'|trans }} {{ address.floor }} {% endif %} {% if address.corridor is not empty %} {{ 'address more.corridor'|trans }} {{ address.corridor }} {% endif %} {% if address.steps is not empty %} {{ 'address more.steps'|trans }} {{ address.steps }} {% endif %} {% if address.buildingName is not empty %} {{ 'address more.buildingName'|trans }} {{ address.buildingName }} {% endif %} {% if address.flat is not empty %} {{ 'address more.flat'|trans }} {{ address.flat }} {% endif %} {% if address.extra is not empty %} {{ 'address more.extra'|trans }} {{ address.extra }} {% endif %} {% if address.distribution is not empty %} {{ 'address more.distribution'|trans }} {{ address.distribution }} {% endif %} {% endmacro %} {% macro inline(address, options) %} {% if options['has_no_address'] == true and address.isNoAddress == true %} {{ 'address.consider homeless'|trans }} {% else %} {{ _self.raw(address, options) }} {% endif %} {{ _self.validity(address, options) }} {% endmacro %} {% macro validity(address, options) %} {%- if options['with_valid_from'] == true -%} {{ 'Since %date%'|trans( { '%date%' : address.validFrom|format_date('long') } ) }} {%- endif -%} {%- if options['with_valid_to'] == true -%} {{ 'Until %date%'|trans( { '%date%' : address.validTo|format_date('long') } ) }} {%- endif -%} {% endmacro %} {%- if render == 'list' -%}
  • {% if options['with_picto'] %} {% endif %} {{ _self.inline(address, options) }}
  • {%- endif -%} {%- if render == 'inline' -%} {% if options['with_picto'] %} {% endif %} {{ _self.inline(address, options) }} {%- endif -%} {%- if render == 'bloc' -%}
    {% if options['has_no_address'] == true and address.isNoAddress == true %}
    {{ 'address.consider homeless'|trans }}
    {% else %}
    {% if options['with_picto'] %} {% endif %} {{ _self.raw(address, options) }}
    {% endif %} {{ _self.validity(address, options) }}
    {%- endif -%}