You are here

calendar-stripe-legend.html.twig in Calendar 8

Template to display a stripe legend for a calendar view.

Available variables:

  • headers: the header labels
  • rows: an associative array holding all rows, each row defines:
    • label: the label of the entity of the current row
    • stripe: the hex code of the color

File

templates/calendar-stripe-legend.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template to display a stripe legend for a calendar view.
  5. *
  6. * Available variables:
  7. * - headers: the header labels
  8. * - rows: an associative array holding all rows, each row defines:
  9. * - label: the label of the entity of the current row
  10. * - stripe: the hex code of the color
  11. *
  12. * @see template_preprocess_calendar_stripe_legend()
  13. *
  14. * @ingroup themeable
  15. */
  16. #}
  17. <div class="calendar calendar-legend">
  18. <table>
  19. <thead>
  20. <tr>
  21. {% for header in headers %}
  22. <td class="calendar-legend">{{ header.label }}</td>
  23. {% endfor %}
  24. </tr>
  25. </thead>
  26. <tbody>
  27. {% for row in rows %}
  28. <tr>
  29. <td>{{ row.label }}</td>
  30. <td><div style="background-color:{{ row.stripe }};color:{{ row.stripe }};" class="calendar-legend" title="Key: {{ row.label }}">{{ row.stripe }} &nbsp;</div></td>
  31. </tr>
  32. {% endfor %}
  33. </tbody>
  34. </table>
  35. </div>