You are here

calendar-day.html.twig in Calendar 8

Same filename and directory in other branches
  1. 8.2 templates/calendar-day.html.twig

Template to display a view as a calendar day, grouped by time and optionally organized into columns by a field value.

  • rows: The rendered data for this day.
  • rows['date'] - the date for this day, formatted as YYYY-MM-DD.
  • rows['datebox'] - the formatted datebox for this day.
  • rows['empty'] - empty text for this day, if no items were found.
  • rows['all_day'] - an array of formatted all day items.
  • rows['items'] - an array of timed items for the day.
  • rows['items'][$time_period]['hour'] - the formatted hour for a time period.
  • rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period.
  • rows['items'][$time_period][$column]['values'] - An array of formatted items for a time period and field column.
  • view: The view.
  • columns: an array of column names.
  • min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
  • max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.

The width of the columns is dynamically set using <col></col> based on the number of columns presented. The values passed in will work to set the 'hour' column to 10% and split the remaining columns evenly over the remaining 90% of the table.

See also

template_preprocess_calendar_day.

File

templates/calendar-day.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Template to display a view as a calendar day, grouped by time
  5. * and optionally organized into columns by a field value.
  6. *
  7. * @see template_preprocess_calendar_day.
  8. *
  9. * - rows: The rendered data for this day.
  10. * - rows['date'] - the date for this day, formatted as YYYY-MM-DD.
  11. * - rows['datebox'] - the formatted datebox for this day.
  12. * - rows['empty'] - empty text for this day, if no items were found.
  13. * - rows['all_day'] - an array of formatted all day items.
  14. * - rows['items'] - an array of timed items for the day.
  15. * - rows['items'][$time_period]['hour'] - the formatted hour for a time period.
  16. * - rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period.
  17. * - rows['items'][$time_period][$column]['values'] - An array of formatted
  18. * items for a time period and field column.
  19. *
  20. * - view: The view.
  21. * - columns: an array of column names.
  22. * - min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
  23. * - max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS.
  24. *
  25. * The width of the columns is dynamically set using <col></col>
  26. * based on the number of columns presented. The values passed in will
  27. * work to set the 'hour' column to 10% and split the remaining columns
  28. * evenly over the remaining 90% of the table.
  29. */
  30. #}
  31. <div class="calendar-calendar"><div class="day-view">
  32. <table class="full">
  33. <col width="{{ first_column_width }}%"></col>
  34. <thead>
  35. {% for column in columns %}
  36. <col width="{{ column_width }}%"></col>
  37. {% endfor %}
  38. <tr>
  39. <th class="calendar-dayview-hour">
  40. {% if by_hour_count > 0 %}
  41. {% trans %}Time{% endtrans %}
  42. {% endif %}
  43. </th>
  44. {% for column in columns %}
  45. <th class="calendar-agenda-items">{{ column }}</th>
  46. {% endfor %}
  47. </tr>
  48. </thead>
  49. <tbody>
  50. {# // All day and multi-day events not support in core DateTime module in Drupal 8
  51. <tr>
  52. <td class="{{ agenda_hour_class }}">
  53. <span class="calendar-hour">
  54. {% if by_hour_count > 0 %}
  55. {% trans %}All day{% endtrans %}
  56. {% endif %}
  57. </span>
  58. </td>
  59. {% for column in columns %}
  60. <td class="calendar-agenda-items multi-day">
  61. <div class="calendar">
  62. <div class="inner">
  63. {% if rows['all_day'][column] is not empty %}
  64. {{ rows['all_day'][column] }}
  65. {% else %}
  66. &nbsp;
  67. {% endif %}
  68. </div>
  69. </div>
  70. </td>
  71. {% endfor %}
  72. </tr>
  73. #}
  74. {% for hour in rows['items'] %}
  75. <tr>
  76. <td class="calendar-agenda-hour">
  77. <span class="calendar-hour">{{ hour.hour }}</span><span class="calendar-ampm">{{ hour.ampm }}></span>
  78. </td>
  79. {% for column in columns %}
  80. <td class="calendar-agenda-items single-day">
  81. <div class="calendar">
  82. <div class="inner">
  83. {% if hour['values'][column] is not empty %}
  84. {{ hour['values'][column] }}
  85. {% else %}
  86. &nbsp;
  87. {% endif %}
  88. </div>
  89. </div>
  90. </td>
  91. {% endfor %}
  92. </tr>
  93. {% endfor %}
  94. </tbody>
  95. </table>
  96. </div></div>