templates/front/hotel/detail/_location.html.twig line 1

Open in your IDE?
  1. {#
  2.     La carte cherche l'hôtel par « nom, ville, pays » : les coordonnées saisies sont souvent imprécises.
  3.     Repli sur latitude/longitude si le nom manque ; sinon pas de carte.
  4. #}
  5. {% set latitude = hotel_data.latitude ?? null %}
  6. {% set longitude = hotel_data.longitude ?? null %}
  7. {% set has_coordinates = latitude is not empty and longitude is not empty and latitude != 0 and longitude != 0 %}
  8. {% set map_query = hotel_data.name is not empty
  9.     ? [hotel_data.name, hotel_location]|filter(v => v is not empty)|join(', ')
  10.     : (has_coordinates ? latitude ~ ',' ~ longitude : null) %}
  11. {% if map_query %}
  12.     <div class="col-md-12">
  13.         <section class="hd-card" id="hotel-location" aria-labelledby="hd-location-title">
  14.             <h2 class="hd-card-title" id="hd-location-title">
  15.                 <span class="hd-card-icon" aria-hidden="true"><i class="bi bi-geo-alt"></i></span>
  16.                 {{ 'Pages.HotelOfferDetail.Messages.HotelEmplacement'|trans({}, 'messages_front') }}
  17.                 {% if hotel_location %}<small>{{ hotel_location }}</small>{% endif %}
  18.             </h2>
  19.             <div class="hd-map">
  20.                 <iframe title="{{ 'Pages.HotelOfferDetail.Messages.HotelEmplacement'|trans({}, 'messages_front') }} – {{ hotel_data.name }}"
  21.                         loading="lazy" referrerpolicy="no-referrer-when-downgrade"
  22.                         src="https://maps.google.com/maps?hl={{ app.request.locale|slice(0, 2) }}&amp;q={{ map_query|url_encode }}&amp;z=14&amp;output=embed"></iframe>
  23.             </div>
  24.             <div class="hd-map-footer">
  25.                 {% if hotel_address is not empty %}
  26.                     <span><i class="fas fa-map-marker-alt" aria-hidden="true"></i>{{ hotel_address }}</span>
  27.                 {% endif %}
  28.                 <a href="https://www.google.com/maps/search/?api=1&amp;query={{ map_query|url_encode }}" target="_blank" rel="noopener">
  29.                     {{ 'Pages.HotelDetail.OpenInMaps'|trans({}, 'messages_front') }}
  30.                     <i class="bi bi-box-arrow-up-right" aria-hidden="true"></i>
  31.                 </a>
  32.             </div>
  33.         </section>
  34.     </div>
  35. {% endif %}