$val) {
$element .= ' ' . $attribute . '="' . $val . '"';
}
$value = $value ?? $json['default']['value'];
$element .= (isset($json['default']) || $value !== null ? ' value="' . ($json['subtype'] === 'datetime' ? (new SmartDateTime($value))->format($json['default']['format']) : $value) . '"' : '');
$element .= ($json['subtype'] === 'checkbox' || $json['subtype'] === 'radio') && $json['default']['checked'] ? ' checked' : '';
$element .= '>';
$element .= $json['subtype'] === 'checkbox' || $json['subtype'] === 'radio' ? '' : '';
return $element;
}
/**
* Generate a form element from a json object
*
* @param array $json Json object representing the form element
* @param mixed $value Null means the default value in the json array will be used
* @param string[] $lang Language array
*
* @return string
*
* @since 1.0.0
*/
private static function generateSelect(array $json, $value = null, array $lang = []) : string
{
$element = '';
return $element;
}
/**
* Generate a form element from a json object
*
* @param array $json Json object representing the form element
* @param mixed $value Null means the default value in the json array will be used
*
* @return string
*
* @since 1.0.0
*/
private static function generateTextarea(array $json, $value = null) : string
{
$element = '';
return $element;
}
/**
* Generate a form element from a json object
*
* @param array $json Json object representing the form element
* @param string[] $lang Language array
*
* @return string
*
* @since 1.0.0
*/
private static function generateLabel(array $json, array $lang = []) : string
{
$element = '';
return $element;
}
}