custom/plugins/EmovaPelletsTheme/src/Resources/views/storefront/utilities/alert-friendly.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_friendly %}
  60.   {% if type != "success" %}
  61.     <div role="alert" class="alert-friendly">
  62.         {% block utilities_alert_content_container %}
  63.             <div class="alert-friendly-content-container">
  64.                 {% block utilities_alert_heading %}
  65.                     {% if heading %}
  66.                         <div class="alert-heading h1">
  67.                             {{ heading }}
  68.                         </div>
  69.                     {% endif %}
  70.                 {% endblock %}
  71.                 {% block utilities_alert_content %}
  72.                     <div class="alert-content h3">
  73.                         {% if list|length > 1 %}
  74.                             <ul class="alert-list">
  75.                                 {% for entry in list %}
  76.                                     <li>{{ entry|sw_sanitize }}</li>
  77.                                 {% endfor %}
  78.                             </ul>
  79.                         {% elseif list|length == 1 %}
  80.                             {% for entry in list %}
  81.                                 {{ entry|sw_sanitize }}
  82.                             {% endfor %}
  83.                         {% else %}
  84.                             {{ content|sw_sanitize }}
  85.                         {% endif %}
  86.                     </div>
  87.                 {% endblock %}
  88.                 {% set modifiedLink = target.link %}
  89.                 {% if target %}
  90.                     {% if target.link == "/" %}
  91.                         {% set modifiedLink = "/pellets/" %}
  92.                     {% endif %}
  93.                     
  94.                     <a class="button" href="{{ modifiedLink }}">{{ target.message }}</a>
  95.                 {% endif %}
  96.             </div>
  97.         {% endblock %}
  98.     </div>
  99.   {% endif %}
  100. {% endblock %}