From 842a71a6ac0e2ad86def0a40bbccbbde5e72ec8b Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Fri, 25 May 2012 14:53:52 +0800 Subject: [PATCH] MDL-33814 Output renderers: table cell objects are only created when needed --- lib/outputcomponents.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 337452af0b4..7ff8d6fb5d3 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -1447,9 +1447,10 @@ class html_writer { if (!($row instanceof html_table_row)) { $newrow = new html_table_row(); - foreach ($row as $item) { - $cell = new html_table_cell(); - $cell->text = $item; + foreach ($row as $cell) { + if (!($cell instanceof html_table_cell)) { + $cell = new html_table_cell($cell); + } $newrow->cells[] = $cell; } $row = $newrow;