calendar-week.html.twig in Calendar 8
Same filename and directory in other branches
Template to display a view as a calendar week.
Available variables:
- day_names: An array of the day of week names for the table header.
- rows: The rendered data for this week.
For each day of the week, you have:
- 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]['values'] - An array of formatted items for a time period.
See also
File
templates/calendar-week.html.twigView source
- {#
- /**
- * @file
- * Template to display a view as a calendar week.
- *
- * Available variables:
- * - day_names: An array of the day of week names for the table header.
- * - rows: The rendered data for this week.
- *
- * For each day of the week, you have:
- * - 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]['values'] - An array of formatted items for a time period.
- *
- * @see template_preprocess_calendar_week()
- *
- * @ingroup themeable
- */
- #}
- <div class="calendar-calendar"><div class="week-view">
- <table class="full">
- <thead>
- <tr>
- {% if by_hour_content > 0 or start_times is not empty %}
- <th class="calendar-agenda-hour">{% trans %}Time{% endtrans %}</th>
- {% endif %}
- {% for cell in day_names %}
- <th class="{{ cell.class }}" id="{{ cell.header_id }}">
- {{ cell.data }}
- </th>
- {% endfor %}
- </tr>
- </thead>
- <tbody>
- {% for i in 0..multiday_rows %}
- {% set row_class = 'all-day' %}
- {% if loop.first %}{% set row_class_extra = 'first' %}{% endif %}
- {% if loop.last %}{% set row_class_extra = 'last' %}{% endif %}
-
- <tr class="{{ row_class }} {{ row_class_extra }}">
- {% if loop.index == 0 and (by_hour_count > 0 or start_times is not empty) %}
- <td class="{{ agenda_hour_class }}" rowspan="{{ multiday_rows }}">
- <span class="calendar-hour">{% trans with {'context': 'datetime'} %}All day{% endtrans %}</span>
- </td>
- {% endif %}
-
- {% set colpos = 0 %}
- {% for j in 0..6 %}
- {% set cell = all_day[j][i] %}
- {% if cell is not empty and cell.filled and cell['wday'] == j %}
- {% for k in colpos..cell['wday'] %}
- <td class="multi-day no-entry"><div class="inner"> </div></td>
- {% endfor %}
- <td colspan="{{ cell['colspan'] }}" class="multi-day">
- <div class="inner">
- {{ cell.entry }}
- </div>
- </td>
- {% set colpos = cell['wday'] + cell['colspan'] + 1 %}
- {% endif %}
- {% endfor %}
-
- {% for j in colpos..6 %}
- <td class="multi-day no-entry"><div class="inner"> </div></td>
- {% endfor %}
- </tr>
- {% endfor %}
- {% for time in items %}
- <tr class="not-all-day">
- <td class="calendar-agenda-hour">
- <span class="calendar-hour">{{ time.hour }}</span><span class="calendar-ampm">{{ time.ampm }}</span>
- </td>
- {% set current_position = 0 %}
- {% for column in columns %}
- {% set column_position = time.values.column[0] ? time.values.column[0].wday : loop.index %}
- {% for i in column_position %}
- <td class="calendar-agenda-items single-day">
- <div class="calendar">
- <div class="inner"> </div>
- </div>
- </td>
- {% endfor %}
- {% set current_position = column_position + 1 %}
- <td class="calendar-agenda-items single-day" headers="{{ header_ids[loop.index - 1] }}">
- <div class="calendar">
- <div class="inner">
- {% for item in time.values[column] %}
- {{ item.entry }}
- {% endfor %}
- </div>
- </div>
- </td>
- {% endfor %}
- {% if current_position < 7 %}
- {% for i in current_position..6 %}
- <td class="calendar-agenda-items single-day">
- <div class="calendar">
- <div class="inner"> </div>
- </div>
- </td>
- {% endfor %}
- {% endif %}
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div></div>