flag.html.twig in Open Social 8.5
Same filename and directory in other branches
- 8.9 themes/socialbase/templates/field/flag.html.twig
- 8 themes/socialbase/templates/field/flag.html.twig
- 8.2 themes/socialbase/templates/field/flag.html.twig
- 8.3 themes/socialbase/templates/field/flag.html.twig
- 8.4 themes/socialbase/templates/field/flag.html.twig
- 8.6 themes/socialbase/templates/field/flag.html.twig
- 8.7 themes/socialbase/templates/field/flag.html.twig
- 8.8 themes/socialbase/templates/field/flag.html.twig
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.
File
themes/socialbase/templates/field/flag.html.twigView source
- {#
- /**
- * @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.
- */
- #}
- {% 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',
- 'btn-default',
- '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>
-
- {% endspaceless %}