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();
$checkBoxOptions = '';
$bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds;
$contentCount = count($bfFrontendFormIds);
if (is_object($field) && property_exists($field, 'opt') && is_countable($field->opt) && count($field->opt) > 0) {
if (isset($field->val) && false !== strpos($field->val, BITFORMS_BF_SEPARATOR)) {
$defaultValues = explode(BITFORMS_BF_SEPARATOR, $field->val);
} else {
$defaultValues = isset($field->val) ? explode(',', $field->val) : [];
}
foreach ($field->opt as $key => $opt) {
$value = isset($opt->val) ? $opt->val : $opt->lbl;
$check = '';
$req = '';
$disabled = '';
$keyChar = chr(65 + $key);
$href = htmlentities("#$rowID-ck-svg");
if ($fieldHelpers->property_exists_nested($opt, 'check', true)) {
$check = 'checked';
} else {
if (in_array($value, $defaultValues)) {
$check = 'checked';
}
}
if ($fieldHelpers->property_exists_nested($opt, 'req', true)) {
$req = 'required';
}
if (
$fieldHelpers->property_exists_nested($field, 'valid->disabled', true)
|| $fieldHelpers->property_exists_nested($opt, 'disabled', true)
) {
$disabled = "disabled='disabled'";
}
$checkBoxOptions .=
'
getCustomAttributes('cw') . '
class="' . $fieldHelpers->getConversationalCls('cw') . ' ' . $fieldHelpers->getCustomClasses('cw') . '"
>
';
}
}
//Other Option
$optCount = isset($field->opt) && is_countable($field->opt) ? count($field->opt) : 0;
$otherOptLbl = !empty($field->otherOptLbl) ? $field->otherOptLbl : __('Other...', 'bit-form');
$inputPh = isset($field->otherInpPh) ? "placeholder='{$fieldHelpers->esc_attr($field->otherInpPh)}'" : "placeholder='Other...'";
$inpReq = isset($field->valid->otherOptReq) ? ($field->valid->otherOptReq ? 'required' : '') : '';
if (property_exists($field, 'addOtherOpt') && $field->addOtherOpt) {
$keyChar = chr(65 + count($field->opt));
$checkBoxOptions .=
'
';
}
return sprintf(
'' . "\n"
. '
' . "\n"
. ' %9$s' . "\n"
. '
',
$fieldHelpers->getCustomAttributes('cc'),
$fieldHelpers->getConversationalCls('cc'),
$fieldHelpers->getCustomClasses('cc'),
$labelId,
$ariaDescribedBy,
$fieldHelpers->getConversationalCls('cks'),
$rowID,
$fieldHelpers->getConversationalCls('ck-svgline'),
$checkBoxOptions
);
}
}