custom/plugins/EmovaWbTheme/src/Resources/views/storefront/utilities/alert.html.twig line 1

Open in your IDE?
  1. {#
  2. Global messages template
  3. https://getbootstrap.com/docs/4.3/components/alerts/
  4. *Type:
  5. The template provides an easy way to display messages in the storefront. The following types are supported:
  6. * primary
  7. * secondary
  8. * danger (red)
  9. * success (green)
  10. * warning (yellow)
  11. * info (blue)
  12. * light (white)
  13. * dark (dark gray)
  14.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  15.         type:"primary",
  16.         content:"Primary Lorem ipsum dolor"
  17.     } %}
  18. *Icons:
  19. Icons are shown by default. To hide the icon within the alert, set the value of "icon" to false:
  20.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  21.         type:"primary",
  22.         content:"Primary Lorem ipsum dolor",
  23.         icon: false
  24.     } %}
  25. *Message Content:
  26. The component requires the parameters ```content``` or ```list``` to display a message. If no ```type``` is defined it
  27. will use the fallback option (success).
  28.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  29.         type:"primary",
  30.         content:"Primary Lorem ipsum dolor"
  31.     } %}
  32. *Message List:
  33. If you need to display a bunch of messages (for example error messages in the registration), you can pass an array
  34. of messages to the template using the parameter ```list```:
  35.      {% set list1 = [
  36.         'Error message 1',
  37.         'Error message 2',
  38.         'Error message 3'
  39.     ] %}
  40.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  41.         type:"secondary",
  42.         list: list1
  43.     } %}
  44. *Heading:
  45. To display a heading, use "heading".
  46.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  47.         type:"primary",
  48.         content:"Primary Lorem ipsum dolor",
  49.         heading: "Test Heading"
  50.     } %}
  51. *Dismissible Button:
  52. To display a dismissible button set the value of "dismissible" to true.
  53.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  54.         type:"primary",
  55.         content:"Primary Lorem ipsum dolor",
  56.         dismissible: true
  57.     } %}
  58. #}
  59. {% block utilities_alert %}
  60.   {% if type != "success" %}
  61.     <div role="alert"
  62.          class="alert {% if type %}alert-{{ type }}{% endif %}{% if dismissible %} alert-dismissible fade show{% endif %}{% if icon != "error" %} alert-has-icon{% endif %}">
  63.         {% block utilities_alert_icon %}
  64.             {% if icon != "false" %}
  65.                 <span class="icon-color icon icon-info">
  66.                     <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 48 48"><style>.st2{fill:#141412}</style><path d="M23.4 18.9h1.3v17.2h-1.3zM23.4 12h1.3v3.7h-1.3z" class="st2"></path><path d="M4.2 35.2C2.3 31.8 1.3 27.9 1.3 24 1.3 11.5 11.5 1.3 24 1.3S46.7 11.5 46.7 24 36.5 46.7 24 46.7c-5.7 0-11.2-2.1-15.4-6l-.9.9C12.2 45.7 17.9 48 24 48c13.2 0 24-10.8 24-24S37.2 0 24 0 0 10.8 0 24c0 4.2 1.1 8.2 3.1 11.8l1.1-.6z" class="st2"></path></svg>
  67.                 </span>
  68. {#
  69.                 {% if type == "danger" %}
  70.                     {% sw_icon 'blocked' %}
  71.                 {% elseif type == "warning" %}
  72.                     {% sw_icon 'warning' %}
  73.                 {% elseif type == "info" %}
  74.                     {% sw_icon 'info' %}
  75.                 {% elseif type == "success" %}
  76.                     {% sw_icon 'checkmark-circle' %}
  77.                 {% else %}
  78.                     {% sw_icon 'alert' %}
  79.                 {% endif %}
  80. #}
  81.             {% endif %}
  82.         {% endblock %}
  83.         {% block utilities_alert_content_container %}
  84.             <div class="alert-content-container">
  85.                 {% block utilities_alert_heading %}
  86.                     {% if heading %}
  87.                         <div class="alert-heading h5">
  88.                             {{ heading }}
  89.                         </div>
  90.                     {% endif %}
  91.                 {% endblock %}
  92.                 {% block utilities_alert_content %}
  93.                     <div class="alert-content">
  94.                         {% if list|length > 1 %}
  95.                             <ul class="alert-list">
  96.                                 {% for entry in list %}
  97.                                     <li>{{ entry|sw_sanitize }}</li>
  98.                                 {% endfor %}
  99.                             </ul>
  100.                         {% elseif list|length == 1 %}
  101.                             {% for entry in list %}
  102.                                 {{ entry|sw_sanitize }}
  103.                             {% endfor %}
  104.                         {% else %}
  105.                             {{ content|sw_sanitize }}
  106.                         {% endif %}
  107.                     </div>
  108.                 {% endblock %}
  109.                 {% block utilities_alert_dismissible %}
  110.                     {% if dismissible %}
  111.                         <button type="button"
  112.                                 class="close"
  113.                                 {{ dataBsDismissAttr }}="alert"
  114.                                 aria-label="Close">
  115.                             <span aria-hidden="true">&times;</span>
  116.                         </button>
  117.                     {% endif %}
  118.                 {% endblock %}
  119.             </div>
  120.         {% endblock %}
  121.     </div>
  122.   {% endif %} 
  123. {% endblock %}