]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19756 Fixed bug in output of fields with a label
authornicolasconnault <nicolasconnault>
Fri, 28 Aug 2009 11:38:33 +0000 (11:38 +0000)
committernicolasconnault <nicolasconnault>
Fri, 28 Aug 2009 11:38:33 +0000 (11:38 +0000)
lib/outputcomponents.php
lib/outputrenderers.php

index cdb7132811c681cb662c4228a3f7bbd5824cd213..72a4cb094fd1fe83ccd2f101ef4fbc2b85a5d672 100644 (file)
@@ -1163,13 +1163,21 @@ class html_table_row extends moodle_html_component {
     }
     
     /**
-     * Shortcut method for creating a row with an array of cells.
+     * Shortcut method for creating a row with an array of cells. Converts cells to html_table_cell objects.
      * @param array $cells
      * @return html_table_row
      */
     public function make($cells=array()) {
         $row = new html_table_row();
-        $row->cells = $cells;
+        foreach ($cells as $celltext) {
+            if (!($celltext instanceof html_table_cell)) {
+                $cell = new html_table_cell();
+                $cell->text = $celltext;
+                $row->cells[] = $cell;
+            } else {
+                $row->cells[] = $celltext;
+            }
+        }
         return $row;
     }
 }
index 1d788c47a54c1224f9aa1ef2442919d1f9fe4f54..bb6ed3344ccff5f0855d6c690840015f7e470591 100644 (file)
@@ -1845,11 +1845,11 @@ class moodle_core_renderer extends moodle_renderer_base {
         $field = clone($field);
         $field->prepare();
         $this->prepare_event_handlers($field);
-        $returned = '';
+        $label = '';
         if (!empty($field->label->text)) {
-            $returned .= $this->label($field->label);
+            $label = $this->label($field->label);
         }
-        $returned .= $this->output_empty_tag('input', array(
+        return $label . $this->output_empty_tag('input', array(
                 'type' => $field->type,
                 'name' => $field->name,
                 'id' => $field->id,