flag-8.x-4.x-dev/modules/flag_count/templates/flag-count.html.twig

modules/flag_count/templates/flag-count.html.twig
{#
/**
 * @file
 * Overriding base flag link template
 *
 * 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.
 */
#}
{# Attach the flag CSS library.#}
{{ attach_library('flag/flag.link') }}

{# 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 = [
    'flag',
    'flag-' ~ flag.id()|clean_class,
    'js-flag-' ~ flag.id()|clean_class ~ '-' ~ flaggable.id(),
    action_class
  ]
%}

{# Attach flag count. #}
{% if flag and flaggable %}
  {% set count = '[' ~ flagcount(flag, flaggable) ~ ']' %}
{% endif %}


{# Set nofollow to prevent search bots from crawling anonymous flag links #}
{% set attributes = attributes.setAttribute('rel', 'nofollow') %}

<div class="{{classes|join(' ')}}">
  <a{{attributes}}>{{ title }}</a>
  {% if count %}
    <span>{{ count }}</span>
  {% endif %}
</div>

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc