function time_field($en, $attr, $label = null) { $error = isset($en->errors[$attr]) ? "validation-error" : ""; $html = '<div class="form-field ' . $error . '">'; $label_text = $label; if ($label == null) { $label_text = Makiavelo::titlelize($attr); } $html .= '<label for="' . $attr . '">' . $label_text . '</label>'; $html .= '<input type="text" class="time-field" name="' . $en->__get_entity_name() . '[' . $attr . ']" id="' . $en->__get_entity_name() . '_' . $attr . '" value="' . $en->{$attr} . '" />'; $html .= "</div>"; return $html; }