wrapper($input);
}
private static function field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error, $value)
{
$fieldHelpers = new ConversationalFieldHelpers($formID, $field, $rowID, $form_atomic_Cls_map);
$req = $fieldHelpers->required();
$name = $fieldHelpers->name();
$ariaDescribedBy = $fieldHelpers->ariaDescribedBy();
$ariaRequired = $fieldHelpers->ariaRequired();
$labelId = $fieldHelpers->getLabelId();
$value = '';
$radioBoxOptions = '';
$bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
$contentCount = count($bfFrontendFormIds);
if (property_exists($field, 'opt') && count($field->opt) > 0) {
$defaultValue = isset($field->val) ? $field->val : '';
foreach ($field->opt as $key => $opt) {
$value = isset($opt->val) ? $opt->val : $opt->lbl;
$check = '';
$req = '';
$lbl = $fieldHelpers->renderHTMR($opt->lbl);
$disabled = '';
$keyChar = chr(65 + $key);
if ($fieldHelpers->property_exists_nested($opt, 'check', true)) {
$check = "checked='{$opt->check}'";
} else {
if ($value === $defaultValue) {
$check = "checked='checked'";
}
}
if ($fieldHelpers->property_exists_nested($opt, 'req', true)) {
$req = "required='{$opt->req}'";
}
if ($fieldHelpers->property_exists_nested($field, 'valid->disabled', true)
|| $fieldHelpers->property_exists_nested($opt, 'disabled', true)) {
$disabled = "disabled='disabled'";
}
$radioBoxOptions .= '
getCustomAttributes('cw') . '
class="' . $fieldHelpers->getConversationalCls('cw') . ' ' . $fieldHelpers->getCustomClasses('cw') . '"
>
getCustomAttributes('ci') . '
id="' . $rowID . '-' . $contentCount . '-chk-' . $key . '"
type="radio"
role="radio"
class="' . $fieldHelpers->getConversationalCls('ci') . ' ' . $fieldHelpers->getCustomClasses('ci') . '"
value="' . $fieldHelpers->esc_attr($value) . '"
' . $check . '
' . $name . '
' . $req . '
' . $disabled . '
/>
';
}
}
//Other Option
$optCount = property_exists($field, 'opt') ? count($field->opt) : 0;
$otherOptLbl = !empty($field->otherOptLbl) ? $field->otherOptLbl : __('Other...', 'bit-form');
$inputPh = isset($field->otherInpPh) ? $field->otherInpPh : 'Other...';
$inpReq = isset($field->valid->otherOptReq) ? ($field->valid->otherOptReq ? 'required' : '') : '';
if (property_exists($field, 'addOtherOpt') && $field->addOtherOpt) {
$keyChar = chr(65 + count($field->opt));
$radioBoxOptions .= '
';
}
return sprintf(
'
%5$s
',
$fieldHelpers->getCustomAttributes('cc'),
$fieldHelpers->getConversationalCls('cc') . ' ' . $fieldHelpers->getCustomClasses('cc'),
$labelId,
$ariaDescribedBy,
$radioBoxOptions
);
}
}