You are here

fivestar-formatter-rating.html.twig in Fivestar 8

Default theme implementation for the Fivestar rating formatter.

Available variables

  • average: The average rating, expressed as an integer from 0 to 100.
  • stars: The number number of stars being used to rate. Usually 5.
  • rating: Rating is a number from 0 to the number of available stars. For example, if the average vote is 40, and the number of stars being used is 5 stars, the rating would be 2.

File

templates/fivestar-formatter-rating.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for the Fivestar rating formatter.
  5. *
  6. * Available variables
  7. * - average: The average rating, expressed as an integer from 0 to 100.
  8. * - stars: The number number of stars being used to rate. Usually 5.
  9. * - rating: Rating is a number from 0 to the number of available stars.
  10. * For example, if the average vote is 40, and the number of stars being
  11. * used is 5 stars, the rating would be 2.
  12. *
  13. * @see template_preprocess_fivestar_formatter_rating()
  14. *
  15. * @ingroup themeable
  16. */
  17. #}
  18. <span class="fivestar-rating">{{ rating ~ '/' ~ stars }}</span>