Skip to content

Commit

Permalink
MDL-19756 Fixed bug in output of fields with a label
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Aug 28, 2009
1 parent 46c6731 commit a019627
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 10 additions & 2 deletions lib/outputcomponents.php
Expand Up @@ -1163,13 +1163,21 @@ public function prepare() {
}

/**
* 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;
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/outputrenderers.php
Expand Up @@ -1845,11 +1845,11 @@ public function field($field) {
$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,
Expand Down

0 comments on commit a019627

Please sign in to comment.