ui/twig/common/modal.html.twig line 1

Open in your IDE?
  1. {% set title = _args.title %}
  2. {% set transition = _args.transition|default('fade') %}
  3. {% set close = (_args.close is defined) ? (_args.close is same as(true)) : true %}
  4. {% set footer = (_args.footer is defined) ? (_args.footer is same as(true)) : true %}
  5. {% set htmlId = _args.htmlId %}
  6. {% set modalClass = _args.modalClass|default(null) %}
  7. {% set media = (_args.media is defined) ? (_args.media is same as(true)) : false %}
  8. {% set triggerHtmlId = _args.triggerHtmlId|default(null) %}
  9. {% set triggerOptions = _args.triggerOptions|default({}) %}
  10. <div class="modal {{ modalClass}} {{ transition }}" id="{{ htmlId }}">
  11.     <div class="modal-dialog {% if media %}modal-media{% endif %}">
  12.         <div class="modal-content">
  13.             <div class="modal-header">
  14.                 {% if media %}
  15.                     {% block header %}{% endblock %}
  16.                 {% endif %}
  17.                 {% if close %}
  18.                     <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  19.                         <span aria-hidden="true">&times;</span>
  20.                     </button>
  21.                 {% endif %}
  22.                 <h4 class="modal-title">{{ title }}</h4>
  23.             </div>
  24.             <div class="modal-body">
  25.                 {% block body %}{% endblock %}
  26.             </div>
  27.             {% if footer %}
  28.                 <div class="modal-footer">
  29.                     {% block footer %}{% endblock %}
  30.                 </div>
  31.             {% endif %}
  32.         </div>
  33.     </div>
  34. </div>
  35. {% if triggerHtmlId is not empty %}
  36.     {% inline_script %}
  37.         <script>
  38.             $(function() {
  39.                 $('body').on('click', '#{{ triggerHtmlId }}', function (e) {
  40.                     $('#{{ htmlId }}').modal({{ triggerOptions|json_encode }});
  41.                     e.preventDefault();
  42.                     e.stopPropagation();
  43.                 });
  44.             });
  45.         </script>
  46.     {% endinline %}
  47. {% endif %}