wrapper($input);
}
private static function field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = null)
{
$fh = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map);
$ph = isset($field->ph) ? $field->ph : '';
$val = !empty($value) ? $value : $fh->value();
$val = 'array' === gettype($val) ? ("value='" . implode(',', $val) . "'") : $val;
$name = $fh->name();
$req = $fh->required();
$readonlyCls = isset($field->valid->readonly) ? 'readonly' : '';
$disabledCls = isset($field->valid->disabled) ? 'disabled' : '';
$selectedOptImage = '';
$optionsList = '';
$activeList = isset($field->config->activeList) ? $field->config->activeList : null;
$allowCustomOption = apply_filters('bitform_dropdown_allow_custom_option', false, $field);
$showSearch = !$fh->property_exists_nested($field, 'config->showSearch', false);
$searchMarkup = '';
$img = htmlentities("data:image/svg+xml,");
$selectedOptImage = apply_filters('bitform_dropdown_selected_opt_image', '', $field, $fh);
if (property_exists($field, 'optionsList')) {
foreach ($field->optionsList as $key => $value) {
$dataIndex = 0;
$valueArr = (array) $value;
$listName = array_keys($valueArr)[0];
$options = array_values($valueArr)[0];
$optionsList .= sprintf(
'
',
$fh->getCustomAttributes('option-list'),
$fh->getAtomicCls('option-list'),
$fh->getCustomClasses('option-list'),
$fh->esc_attr($listName),
$key
);
if ($allowCustomOption) {
$optionsList .= sprintf(
'-
Create:
',
$fh->getCustomAttributes('option'),
$dataIndex,
$fh->getCustomClasses('option'),
$fh->getCustomAttributes('opt-lbl-wrp'),
$fh->getCustomClasses('opt-lbl-wrp'),
$fh->getCustomAttributes('opt-lbl'),
$fh->getCustomClasses('opt-lbl')
);
}
foreach ($options as $opt) {
if (isset($opt->type)) {
$disableOpt = isset($opt->disabled) ? 'disabled-opt' : '';
$optionsList .= sprintf(
'-
%7$s
',
$dataIndex,
$fh->getCustomAttributes('option'),
$fh->getCustomClasses('option'),
$disableOpt,
$fh->getCustomAttributes('opt-lbl'),
$fh->getCustomClasses('opt-lbl'),
$fh->kses_post($opt->title)
);
foreach ($opt->childs as $child) {
$optVal = isset($child->val) ? $child->val : $child->lbl;
$disableOpt = (isset($opt->disabled) || isset($child->disabled)) ? 'disabled-opt' : '';
$optImage = '';
if (isset($child->img)) {
$optImage = sprintf(
'
',
$fh->getCustomAttributes('opt-icn'),
$fh->getCustomClasses('opt-icn'),
$fh->esc_attr($child->lbl),
$fh->esc_url($child->img)
);
}
$optionsList .= sprintf(
'-
%8$s
%11$s
',
$fh->getCustomAttributes('option'),
$dataIndex,
$fh->esc_attr($optVal),
$fh->getCustomClasses('option'),
$disableOpt,
$fh->getCustomAttributes('opt-lbl-wrp'),
$fh->getCustomClasses('opt-lbl-wrp'),
$optImage,
$fh->getCustomAttributes('opt-lbl'),
$fh->getCustomClasses('opt-lbl'),
$fh->kses_post($child->lbl)
);
}
} else {
$optVal = isset($opt->val) ? $opt->val : $opt->lbl;
$disableOpt = isset($opt->disabled) ? 'disabled-opt' : '';
$optImage = '';
if (isset($opt->img)) {
$optImage = sprintf(
'
',
$fh->getCustomAttributes('opt-icn'),
$fh->getCustomClasses('opt-icn'),
$fh->esc_attr($opt->lbl),
$fh->esc_url($opt->img)
);
}
$optionsList .= sprintf(
'-
%8$s
%11$s
',
$fh->getCustomAttributes('option'),
$dataIndex,
$fh->esc_attr($optVal),
$fh->getCustomClasses('option'),
$disableOpt,
$fh->getCustomAttributes('opt-lbl-wrp'),
$fh->getCustomClasses('opt-lbl-wrp'),
$optImage,
$fh->getCustomAttributes('opt-lbl'),
$fh->getCustomClasses('opt-lbl'),
$fh->kses_post($opt->lbl)
);
}
}
$optionsList .= '
';
$dataIndex++;
}
$optionsList .= sprintf(
'',
$fh->getCustomAttributes('option-list'),
$fh->getAtomicCls('option-list'),
$fh->getCustomClasses('option-list')
);
$multiChipClass = ($fh->property_exists_nested($field, 'config->multipleSelect', true) && $fh->property_exists_nested($field, 'config->showChip', true)) ? 'multi-chip' : '';
if ($showSearch) {
$searchMarkup = sprintf(
'
',
$fh->getCustomAttributes('option-search-wrp'),
$fh->getAtomicCls('option-search-wrp'),
$fh->getCustomClasses('option-search-wrp'),
$fh->getCustomAttributes('opt-search-input'),
$fh->getAtomicCls('opt-search-input'),
$fh->getCustomClasses('opt-search-input'),
$fh->getCustomAttributes('opt-search-icn'),
$fh->getAtomicCls('icn'),
$fh->getAtomicCls('opt-search-icn'),
$fh->getCustomClasses('opt-search-icn'),
$fh->getCustomAttributes('search-clear-btn'),
$fh->getAtomicCls('icn'),
$fh->getAtomicCls('search-clear-btn'),
$fh->getCustomClasses('search-clear-btn')
);
}
return sprintf(
'',
$fh->getAtomicCls('dpd-fld-container'), // 1
$fh->getCustomClasses('dpd-fld-container'), // 2
$fh->getCustomAttributes('dpd-fld-wrp'), // 3
$fh->getAtomicCls('dpd-fld-wrp'), // 4
$fh->getCustomClasses('dpd-fld-wrp'), // 5
$readonlyCls, // 6
$disabledCls, // 7
$name, // 8
$req, // 9
$fh->getAtomicCls('dpd-hidden-input'), // 10
$fh->disabled(), // 11
$fh->readonly(), // 12
$val, // 13
$fh->getCustomAttributes('dpd-wrp'), // 14
$fh->getAtomicCls('dpd-wrp'), // 15
$fh->getCustomClasses('dpd-wrp'), // 16
$fh->getCustomAttributes('selected-opt-wrp'), // 17
$fh->getAtomicCls('selected-opt-wrp'), // 18
$fh->getCustomClasses('selected-opt-wrp'), // 19
$selectedOptImage, // 20
$fh->getCustomAttributes('selected-opt-lbl'), // 21
$fh->getAtomicCls('selected-opt-lbl'), // 22
$multiChipClass, // 23
$fh->getCustomClasses('selected-opt-lbl'), // 24
$fh->esc_html($ph), // 25
$fh->getCustomAttributes('dpd-btn-wrp'), // 26
$fh->getAtomicCls('dpd-btn-wrp'), // 27
$fh->getCustomClasses('dpd-btn-wrp'), // 28
$fh->getCustomAttributes('selected-opt-clear-btn'), // 29
$fh->getAtomicCls('selected-opt-clear-btn'), // 30
$fh->getCustomClasses('selected-opt-clear-btn'), // 31
$fh->getCustomAttributes('dpd-down-btn'), // 32
$fh->getAtomicCls('dpd-down-btn'), // 33
$fh->getCustomClasses('dpd-down-btn'), // 34
$fh->getCustomAttributes('option-wrp'), // 35
$fh->getAtomicCls('option-wrp'), // 36
$fh->getCustomClasses('option-wrp'), // 37
$fh->getCustomAttributes('option-inner-wrp'), // 38
$fh->getAtomicCls('option-inner-wrp'), // 39
$fh->getCustomClasses('option-inner-wrp'), // 40
$searchMarkup, // 41
$optionsList // 42
);
}
}
}