You are here

poll-meter.html.twig in Poll 8

Default theme implementation for a meter.

Available variables:

  • display_value: The textual representation of the meter bar.
  • form: One or more forms to which the <meter> element belongs; multiple forms separated by spaces.
  • high: A number specifying the range that is considered to be a high value.
  • low: A number specifying the range that is considered to be a low value.
  • max: A number specifying the maximum value of the range.
  • min: A number specifying the minimum value of the range.
  • optimum: A number specifying what value is the optimal value for the gauge.
  • value: A number specifying the current value of the gauge.
  • percentage: A number specifying the current percentage of the gauge.
  • attributes: HTML attributes for the containing element.
  • choice: The choice of a poll.

File

templates/poll-meter.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a meter.
  5. *
  6. * Available variables:
  7. * - display_value: The textual representation of the meter bar.
  8. * - form: One or more forms to which the <meter> element belongs; multiple
  9. * forms separated by spaces.
  10. * - high: A number specifying the range that is considered to be a high value.
  11. * - low: A number specifying the range that is considered to be a low value.
  12. * - max: A number specifying the maximum value of the range.
  13. * - min: A number specifying the minimum value of the range.
  14. * - optimum: A number specifying what value is the optimal value for the gauge.
  15. * - value: A number specifying the current value of the gauge.
  16. * - percentage: A number specifying the current percentage of the gauge.
  17. * - attributes: HTML attributes for the containing element.
  18. * - choice: The choice of a poll.
  19. *
  20. * @see template_preprocess()
  21. * @see template_preprocess_region()
  22. *
  23. * @ingroup themeable
  24. */
  25. #}
  26. {% set is_current_selection_class = is_current_selection ? 'is-current-selection' : 'not-current-selection' %}
  27. <dt class="choice-title {{ is_current_selection_class }}">{{ choice }}</dt>
  28. <dd class="choice-result {{ is_current_selection_class }}">
  29. <div{{ attributes }}>
  30. <div style="width: {{ percentage }}%" class="foreground"></div>
  31. </div>
  32. {% if display_value %}
  33. <div class="percent">{{ display_value }}</div>
  34. {% endif %}
  35. </dd>