templates/components/button.html.twig line 1

Open in your IDE?
  1. {% set classButton = classButton|default(null) %}
  2. {% set picto = picto|default(null) %}
  3. {% set classText = classText|default(null) %}
  4. {% set text = text|default(null) %}
  5. {% set name = name|default(null) %}
  6. {% set href = href|default('#') %}
  7. {% set isLink = isLink|default(false) %}
  8. {% set type = type|default('button') %}
  9. {% set isDisabled = isDisabled|default(false) %}
  10. {% set dataClose = dataClose|default(false) %}
  11. {% set dataOpen = dataOpen|default(false) %}
  12. {% set id = id|default(null) %}
  13. {% set only_picto = only_picto|default(false) %}
  14. {% set openEditModal = openEditModal|default(false) %}
  15. {% set pictoTable = pictoTable ?? false %}
  16. {% set tooltipTitle = tooltipTitle ?? false %}
  17. {% set isTargetBlank = isTargetBlank ?? false %}
  18. {% set dataHref = dataHref ?? null %}
  19. {% set formaction = formaction ?? null %}
  20. {% set refererAction = refererAction ?? null %}
  21. {% set printIframeUrl = printIframeUrl ?? null %}
  22. {% set printPdf = printPdf ?? null %}
  23. {% if isLink %}
  24.     <a
  25.         class="button {% if only_picto %}only-picto{% endif %} {{classButton}}"
  26.         href="{{ href }}"
  27.         {% if isDisabled %}
  28.             disabled="disabled"
  29.         {% endif %}
  30.         {% if id %}
  31.             id="{{ id }}"
  32.         {% endif %}
  33.         {% if name %}
  34.             name="{{ name }}"
  35.         {% endif %}
  36.         {% if isTargetBlank %}
  37.             target="_blank"
  38.             rel="noopener"
  39.         {% endif %}
  40.         {% if tooltipTitle %}
  41.             data-tooltip title="{{tooltipTitle}}"
  42.         {% endif %}
  43.     >
  44.         {% if picto %}
  45.             {% include 'Layout/includes/pictos/' ~ picto ~ '.html.twig' %}
  46.         {% endif %}
  47.         {% if text %}
  48.             <b class=" {{classText}}">
  49.                 {{text}}
  50.             </b>
  51.         {% endif %}
  52.     </a>
  53. {% else %}
  54.     <button
  55.         type="{{ type }}"
  56.         class="button {% if only_picto %}only-picto{% endif %} {% if pictoTable %}picto-table{% endif %} {{ classButton }}"
  57.         {% if formaction %}
  58.             formaction="{{ formaction }}"
  59.         {% endif %}
  60.         {% if openEditModal %}
  61.             data-display-in-modal="true"
  62.             data-modal-id="js-modal-container"
  63.             data-ajax-modal-container='#js-modal'
  64.             data-ajax-href="{{ dataHref }}"
  65.         {% endif %}
  66.         {% if refererAction %}
  67.             data-referer-action="{{ refererAction }}"
  68.             data-modal-id="js-modal-container"
  69.             data-ajax-modal-container="#js-modal"
  70.         {% endif %}
  71.         {% if isDisabled %}
  72.             disabled="disabled"
  73.         {% endif %}
  74.         {% if id %}
  75.             id="{{ id }}"
  76.         {% endif %}
  77.         {% if dataClose %}
  78.             data-close
  79.         {% endif %}
  80.         {% if dataOpen %}
  81.             data-open={{dataOpen}}
  82.         {% endif %}
  83.         {% if printIframeUrl %}
  84.             data-print-url="{{ printIframeUrl }}"
  85.         {% endif %}
  86.         {% if printPdf %}
  87.             data-print-pdf = "{{ printPdf }}"
  88.         {% endif %}
  89.         {% if tooltipTitle %}
  90.             data-tooltip title="{{tooltipTitle}}"
  91.         {% endif %}
  92.         {% if name %}
  93.             name="{{ name }}"
  94.         {% endif %}
  95.     >
  96.         {% if picto %}
  97.             {% include 'Layout/includes/pictos/' ~ picto ~ '.html.twig' %}
  98.         {% endif %}
  99.         {% if text %}
  100.             <b class=" {{classText}}">
  101.                 {{text}}
  102.             </b>
  103.         {% endif %}
  104.     </button>
  105. {% endif %}