diff --git a/calendar/renderer.php b/calendar/renderer.php
index c20771a9c8e..9c484e6dd51 100644
--- a/calendar/renderer.php
+++ b/calendar/renderer.php
@@ -423,8 +423,6 @@ class core_calendar_renderer extends plugin_renderer_base {
$week = 1;
$dayweek = $startwday;
- $row = new html_table_row(array());
-
// Create an array of all the week days.
$wdays = array(0 => ''. get_string('sunday', 'calendar'). '',
1 => ''. get_string('monday', 'calendar'). '',
@@ -443,9 +441,8 @@ class core_calendar_renderer extends plugin_renderer_base {
array_push($wdays, $wdays_end);
}
- // Now we set the (modified) array to the table cells to be displayed.
- $row->cells = $wdays;
- $table->data[] = $row;
+ // Now we set the (modified) array to the table header to be displayed.
+ $table->head = $wdays;
$row = new html_table_row(array());