}
/**
- * 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;
}
}
$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,