socialbase-1.1.0/templates/field/flag.html.twig
templates/field/flag.html.twig
{#
/**
* @file
* Default theme implementation for flag links.
*
* Available variables:
* - attributes: HTML attributes for the link element.
* - title: The flag link title.
* - action: 'flag' or 'unflag'
* - flag: The flag object.
* - flaggable: The flaggable entity.
*/
#}
{% apply spaceless %}
{# Depending on the flag action, set the appropriate action class. #}
{% if action == 'unflag' %}
{% set action_class = 'action-unflag' %}
{% else %}
{% set action_class = 'action-flag' %}
{% endif %}
{# Set the remaining Flag CSS classes. #}
{% set classes = [
'btn',
follow_user ? '' : 'btn-sm',
'btn-follow',
'flag',
'flag-' ~ flag.id()|clean_class,
'js-flag-' ~ flag.id()|clean_class ~ '-' ~ flaggable.id(),
action_class
] %}
{% set attributes = attributes.addClass(classes) %}
<a role="button"{{ attributes }}>{{ title }}</a>
{% endapply %}
