Skip to content

Commit

Permalink
Added InputField checking to Html::form
Browse files Browse the repository at this point in the history
  • Loading branch information
strongishllama committed Sep 3, 2019
1 parent 612f8be commit 11ab686
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions system/html.php
Expand Up @@ -341,11 +341,22 @@ public static function form($data, $action = null, $method = "POST", $submitTitl
foreach ($data as $field) {
$buffer .= "<div class='row-fluid'><div class='small-12'>";

// Check if the row is an object like an InputField
if (!is_array($field) && is_object($field)) {
if ((property_exists($field, "type") && $field->type !== "hidden") || !property_exists($field, "type")) {
$buffer .= '<li><label class=\'small-12 columns\'>' . $field->label . ($field->required ? " <small>Required</small>" : "") . '<div>' . $field->__toString() . '</div></label></li>';
} else {
$buffer .= $field->__toString();
}
continue;
}

$title = !empty($field[0]) ? $field[0] : null;
$type = !empty($field[1]) ? $field[1] : null;
$name = !empty($field[2]) ? $field[2] : null;
$value = !empty($field[3]) ? $field[3] : null;
$readonly = "";

// handle disabled fields
if ($name[0] == '-') {
$name = substr($name, 1);
Expand Down

0 comments on commit 11ab686

Please sign in to comment.