Skip to content

Commit

Permalink
Preparation for class renaming in next ODR update
Browse files Browse the repository at this point in the history
  • Loading branch information
staticall committed Aug 15, 2018
1 parent d07717e commit a67155c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/build-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ function fieldToHtml($name, array $field)
$html = '<input type="#TYPE#" name="#NAME#"#REQUIRED##READONLY##CLASSNAME##TITLE#>';

$r = array(
'#TYPE#' => $field['class'] === 'String_Email' ? 'email' : 'text',
'#TYPE#' => in_array($field['class'], array('String_Email', 'Text_Email'), true) ? 'email' : 'text',
'#NAME#' => $name,
'#REQUIRED#' => empty($field['is_required']) ? '' : ' required',
'#READONLY#' => empty($field['is_readonly']) ? '' : ' readonly',
'#CLASSNAME#' => empty($field['classname']) ? '' : ' class="' . $field['classname'] . '"',
'#TITLE#' => empty($field['title']) ? ' placeholder="' . $name . '"' : ' title="' . $field['title'] . '" placeholder="' . $field['title'] . '"',
);

if (strpos($field['class'], 'String_Textarea') === 0) {
if (strpos($field['class'], 'String_Textarea') === 0 || strpos($field['class'], 'Text_Textarea') === 0) {
$html = '<textarea name="#NAME#"#REQUIRED##READONLY##CLASSNAME##TITLE#></textarea>';
} elseif ($field['class'] === 'String_Nameserver') {
} elseif (in_array($field['class'], array('String_Nameserver', 'Text_Nameserver'), true)) {
$html = '<input type="#TYPE#" name="#NAME#[host]"#REQUIRED##READONLY##CLASSNAME##TITLE#>';
} elseif (strpos($field['class'], 'Checkbox') === 0) {
$html = '<label><input type="checkbox" value="1"#REQUIRED##READONLY##CLASSNAME#>' . (!empty($field['title']) ? $field['title'] : $name) . '</label>';
Expand Down

0 comments on commit a67155c

Please sign in to comment.