bootstrap_components_toolkit-1.0.0/templates/bootstrap-badge.html.twig
templates/bootstrap-badge.html.twig
{#
/**
* @file
* Template for Bootstrap Badge, an extension of Bootstrap Badge.
*
* Available config:
* - type: primary | secondary | success | danger | warning | info | light | dark
* - is_dark: Wether to contrast using dark color
* - rounded: Wether to round corners
* - badge_content: The content of the badge.
* - url: if an url is present, a wrapper will be set automatically.
*/
#}
{% set component_base = 'badge' %}
{% set attributes = safe_create_attribute(attributes) %}
{%
set merged_classes = [
component_base,
type ? ['bg', type] | join('-') : 'bg-primary',
is_dark ? 'text-dark',
rounded ? 'rounded-pill',
] | merge(classes ? classes : [])
%}
{% if url %}
{% set url = url|render %}
{% endif %}
{% if badge_content or block('badge_content') %}
{% if url %}
<a href="{{url}}">
{% endif %}
<span {{ attributes.addClass(merged_classes) }}>
{% block badge_content %}
{{ badge_content }}
{% endblock %}
</span>
{% if url %}
</a>
{% endif %}
{% endif %}
