templates/component/button.html.twig line 1

Open in your IDE?
  1. {#
  2.     component: button
  3.   
  4. #}
  5. {% set props = {
  6.     title: null,
  7.     text: null,
  8.     to: null,
  9.     externe: null,
  10.     icon: null,
  11.     blank: false,
  12.     theme: null,
  13.     arrow:false,
  14.     size: null,
  15.     class:null,
  16.     type:"button",
  17.     contactButton:false,
  18.     bookingLink:null,
  19.     rel:"",
  20.     aquao:null,
  21.     category:"reservation"
  22. }|merge(props|default({}))  %}
  23. {# Modifier classes #}
  24. {% set modifierClasses = [] %}
  25. {% if props.theme %}
  26.     {% set modifierClasses = modifierClasses|merge(['Button-component--' ~ props.theme ~ '-theme']) %}
  27. {% endif %}
  28. {% if props.size %}
  29.     {% set modifierClasses = modifierClasses|merge(['Button-component--' ~ props.size ~ '-size']) %}
  30. {% endif %}
  31. {% if props.class %}
  32.     {% set modifierClasses = modifierClasses|merge([' ' ~ props.class ]) %}
  33. {% endif %}
  34. {# Target #}
  35. {% set targetAttributes = '' %}
  36. {% if props.blank %}
  37.     {% set targetAttributes = targetAttributes ~ 'target="_blank" rel="no-referrer"' %}
  38. {% endif %}
  39. {% set tag = "button" %}
  40. {% if props.to %}
  41.     {% set tag = "a" %}
  42. {% endif %}
  43. <{{tag}} {% if tag != 'a' %} type="{{props.type}}" {% endif %} {% if props.bookingLink %} data-bookinglink="{{ props.bookingLink}}" {% endif %} {% if props.aquao is defined %} data-aquao="{{ props.aquao}}" {% endif %} data-component="button" class="Button-component{{ ' ' ~ modifierClasses | join(' ') }}" {% if props.to %} href="{{ props.to }}" {% endif %} {% if props.to != "#" %} target="{{props.externe}}" {% endif %} data-category="{{props.category}}" title="{{ props.title }}" {{ targetAttributes }} rel="{{ props.rel }}">
  44.     {% if props.contactButton %}
  45.         {% set schemeAndHttpHost = app.request.getSchemeAndHttpHost %}
  46.         {# {% if 'miramar-lacigale.com' in schemeAndHttpHost %}
  47.                                                                                                                                                                                                     <!--
  48.                                                                                                                                                                                                             Event snippet for [MIRAMAR] - CONTACT on : Please do not remove.
  49.                                                                                                                                                                                                             Place this snippet on pages with events you’re tracking. 
  50.                                                                                                                                                                                                             Creation date: 07/15/2020
  51.                                                                                                                                                                                                             -->
  52.                                                                                                                                                                                                     <script>
  53.                                                                                                                                                                                                         gtag('event', 'conversion', {
  54.                                                                                                                                                                                                         'allow_custom_scripts': true,
  55.                                                                                                                                                                                                         'send_to': 'DC-10209412/invmedia/miram000+standard'
  56.                                                                                                                                                                                                         });
  57.                                                                                                                                                                                                     </script>
  58.                                                                                                                                                                                                     <noscript>
  59.                                                                                                                                                                                 
  60.                                                                                                                                                                                                         <img src="https://ad.doubleclick.net/ddm/activity/src=10209412;type=invmedia;cat=miram000;dc_lat=;dc_rdid=;tag_for
  61.                                                                                                                                                                                                                             _child_directed_treatment=;tfua=;npa=;ord=1?" width="1" height="1" alt=""/>
  62.                                                                                                                                                                                                     </noscript>
  63.                                                                                                                                                                                                     <!-- End of event snippet: Please do not remove -->
  64.                                                                                                                                                                                                 {% endif %} #}
  65.     {% endif %}
  66.     {% if props.icon %}
  67.         {% include "component/svg.html.twig" with {
  68.       props: {
  69.         name: props.icon
  70.       }
  71.     } %}
  72.     {% endif %}
  73.     {% if props.arrow %}
  74.         {% include "component/svg.html.twig" with {
  75.       props: {
  76.         name: 'arrow-down'
  77.       }
  78.     } %}
  79.     {% endif %}
  80.     <span class="Button-text">{{ props.text }}</span>
  81. </{{tag}}>