custom/static-plugins/product-labels/src/Resources/views/storefront/component/product-label/badge.html.twig line 1

Open in your IDE?
  1. {% block component_product_label_badge %}
  2.     {% if not badgeContent %}
  3.         {% set badgeContent = customLabel.content %}
  4.     {% endif %}
  5.     {% set badgeMarginTop = customLabel.marginTop|default(0) %}
  6.     {% set badgeMarginRight = customLabel.marginRight|default(0) %}
  7.     {% set badgeMarginBottom = customLabel.marginBottom|default(0) %}
  8.     {% set badgeMarginLeft = customLabel.marginLeft|default(0) %}
  9.     {% if badgeMarginTop or badgeMarginRight or badgeMarginBottom or badgeMarginLeft %}
  10.         {% set badgeMargin = badgeMarginTop ~ " " ~ badgeMarginRight ~ " " ~ badgeMarginBottom ~ " " ~ badgeMarginLeft %}
  11.     {% endif %}
  12.     {% if not badgeHeight %}
  13.         {% set badgeHeight = customLabel.height %}
  14.     {% endif %}
  15.     {% if not badgeWidth %}
  16.         {% set badgeWidth = customLabel.width %}
  17.     {% endif %}
  18.     {% block component_product_label_badge_element %}
  19.         {% if context.salesChannel.id in customLabel.salesChannelIds or not customLabel.salesChannelIds %}
  20.         <div class="custom-badge badge badge-success badge-{{ badgePosition }}
  21.                 {% if customLabel.shape == "round" %} rounded-pill{% endif %}
  22.                 {% if customLabel.shape == "circle" %} rounded-circle{% endif %}
  23.                 {% if badgeHeight %}has-height{% endif %}
  24.                 {{ customLabel.customClasses }}"
  25.              style="background-color: {{ customLabel.color }};
  26.                  {% if badgeMargin %}margin:{{ badgeMargin }};{% endif %}
  27.                  {% if badgeHeight %}height:{{ badgeHeight }}px;{% endif %}
  28.                  {% if badgeWidth %}width:{{ badgeWidth }}px;{% endif %}">
  29.             {% block component_product_label_badge_content %}
  30.                 {{ badgeContent }}
  31.             {% endblock %}
  32.         </div>
  33.     {% endif %}
  34.     {% endblock %}
  35. {% endblock %}