You are here

like-and-dislike-icons.html.twig in Like & Dislike 8

The template file to display icons for the like and dislike links.

Available variables:

  • entity_id: The id of the entity for which is the vote is done.
  • entity_type: The entity type id of the entity for which the vote is done.
  • icons: An associative array of icons keyed by type. Each icon contains the following properties:

    • label: The label for the vote type.
    • count: The number of votes.
    • attributes: HTML attributes for the vote link.

File

templates/like-and-dislike-icons.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * The template file to display icons for the like and dislike links.
  5. *
  6. * Available variables:
  7. * - entity_id: The id of the entity for which is the vote is done.
  8. * - entity_type: The entity type id of the entity for which the vote is
  9. * done.
  10. * - icons: An associative array of icons keyed by type. Each icon contains
  11. * the following properties:
  12. * - label: The label for the vote type.
  13. * - count: The number of votes.
  14. * - attributes: HTML attributes for the vote link.
  15. */
  16. #}
  17. <div class="vote-widget-wrapper">
  18. <div class="vote-widget vote-widget--like-and-dislike">
  19. {% for type, icon in icons %}
  20. <div class="vote-{{ type }} type-{{ entity_type }}" id="{{ type }}-container-{{ entity_type }}-{{ entity_id }}">
  21. <a {{ icon.attributes }}>{{ icon.label }}</a>
  22. <span class="count">{{ icon.count }}</span>
  23. </div>
  24. {% endfor %}
  25. </div>
  26. </div>