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

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/utilities/alert.html.twig' %}
  2. {#
  3. Global messages template
  4. https://getbootstrap.com/docs/4.3/components/alerts/
  5. *Type:
  6. The template provides an easy way to display messages in the storefront. The following types are supported:
  7. * primary
  8. * secondary
  9. * danger (red)
  10. * success (green)
  11. * warning (yellow)
  12. * info (blue)
  13. * light (white)
  14. * dark (dark gray)
  15.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  16.         type:"primary",
  17.         content:"Primary Lorem ipsum dolor"
  18.     } %}
  19. *Icons:
  20. Icons are shown by default. To hide the icon within the alert, set the value of "icon" to false:
  21.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  22.         type:"primary",
  23.         content:"Primary Lorem ipsum dolor",
  24.         icon: false
  25.     } %}
  26. *Message Content:
  27. The component requires the parameters ```content``` or ```list``` to display a message. If no ```type``` is defined it
  28. will use the fallback option (success).
  29.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  30.         type:"primary",
  31.         content:"Primary Lorem ipsum dolor"
  32.     } %}
  33. *Message List:
  34. If you need to display a bunch of messages (for example error messages in the registration), you can pass an array
  35. of messages to the template using the parameter ```list```:
  36.      {% set list1 = [
  37.         'Error message 1',
  38.         'Error message 2',
  39.         'Error message 3'
  40.     ] %}
  41.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  42.         type:"secondary",
  43.         list: list1
  44.     } %}
  45. *Heading:
  46. To display a heading, use "heading".
  47.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  48.         type:"primary",
  49.         content:"Primary Lorem ipsum dolor",
  50.         heading: "Test Heading"
  51.     } %}
  52. *Dismissible Button:
  53. To display a dismissible button set the value of "dismissible" to true.
  54.     {% sw_include '@Storefront/storefront/utilities/alert.html.twig' with {
  55.         type:"primary",
  56.         content:"Primary Lorem ipsum dolor",
  57.         dismissible: true
  58.     } %}
  59. #}
  60. {% block utilities_alert %}
  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.                 {% if type == "danger" %}
  66.                     <span class="material-icons icon">error</span>
  67.                 {% elseif type == "warning" %}
  68.                     <span class="material-icons icon">warning</span>
  69.                 {% elseif type == "info" %}
  70.                     <span class="material-icons icon">info</span>
  71.                 {% elseif type == "success" %}
  72.                     <span class="material-icons icon">check</span>
  73.                 {% else %}
  74.                     <span class="material-icons icon">error</span>
  75.                 {% endif %}
  76.             {% endif %}
  77.         {% endblock %}
  78.         {% block utilities_alert_content_container %}
  79.             <div class="alert-content-container">
  80.                 {% block utilities_alert_heading %}
  81.                     {% if heading %}
  82.                         <div class="alert-heading h5">
  83.                             {{ heading }}
  84.                         </div>
  85.                     {% endif %}
  86.                 {% endblock %}
  87.                 {% block utilities_alert_content %}
  88.                     <div class="alert-content">
  89.                         {% if list|length > 1 %}
  90.                             <ul class="alert-list">
  91.                                 {% for entry in list %}
  92.                                     <li>{{ entry|sw_sanitize }}</li>
  93.                                 {% endfor %}
  94.                             </ul>
  95.                         {% elseif list|length == 1 %}
  96.                             {% for entry in list %}
  97.                                 {{ entry|sw_sanitize }}
  98.                             {% endfor %}
  99.                         {% else %}
  100.                             {{ content|sw_sanitize }}
  101.                         {% endif %}
  102.                     </div>
  103.                 {% endblock %}
  104.                 {% block utilities_alert_dismissible %}
  105.                     {% if dismissible %}
  106.                         <button type="button"
  107.                                 class="close"
  108.                                 data-dismiss="alert"
  109.                                 aria-label="Close">
  110.                             <span aria-hidden="true">&times;</span>
  111.                         </button>
  112.                     {% endif %}
  113.                 {% endblock %}
  114.             </div>
  115.         {% endblock %}
  116.     </div>
  117. {% endblock %}