form = $form;
$this->title = $title;
}
protected function html_content($exclude = [], $include = [])
{
if (!empty($this->title))
echo '
';
if (isset($field['before']))
echo $field['before'];
if ($field['type'] !== 'checkbox')
if (isset($field['label']))
echo '
';
else
echo '
';
switch ($field['type'])
{
case 'select':
$this->renderSelect($field_id, $field);
break;
case 'radio':
$this->renderRadio($field_id, $field);
break;
case 'checkbox':
$this->renderCheckbox($field_id, $field);
break;
case 'textarea':
$this->renderTextArea($field_id, $field);
break;
case 'color':
$this->renderColor($field_id, $field);
break;
case 'numeric':
$this->renderNumeric($field_id, $field);
break;
case 'file':
$this->renderFile($field_id, $field);
break;
case 'captcha':
$this->renderCaptcha($field_id, $field);
break;
case 'text':
case 'password':
default:
$this->renderText($field_id, $field);
}
if (isset($field['after']))
echo ' ', $field['after'];
if ($field['type'] !== 'checkbox')
echo '
';
echo '
';
}
private function renderCaptcha($field_id, array $field)
{
echo '
';
}
private function renderCheckbox($field_id, array $field)
{
echo '
';
}
private function renderColor($field_id, array $field)
{
echo '
';
}
private function renderFile($field_id, array $field)
{
if (!empty($this->data[$field_id]))
echo 'Currently using asset
', $this->data[$field_id], '. Upload to overwrite.
';
echo '
';
}
private function renderNumeric($field_id, array $field)
{
echo '
';
}
private function renderRadio($field_id, array $field)
{
foreach ($field['options'] as $value => $option)
echo '
data[$field_id] == $value ? ' checked' : '', !empty($field['disabled']) ? ' disabled' : '', '>
';
}
private function renderSelect($field_id, array $field)
{
echo '
';
}
private function renderSelectOption($field_id, $label, $value, $multiple = false)
{
echo '
';
}
private function renderSelectOptionGroup($field_id, $label, $options)
{
echo '
';
}
private function renderText($field_id, array $field)
{
echo '
data[$field_id]) ? ' value="' . htmlspecialchars($this->data[$field_id]) . '"' : '',
isset($field['placeholder']) ? ' placeholder="' . $field['placeholder'] . '"' : '',
!empty($field['disabled']) ? ' disabled' : '',
isset($field['trigger']) ? ' class="trigger-' . $field['trigger'] . '"' : '',
'>';
}
private function renderTextArea($field_id, array $field)
{
echo '
';
}
}