wrapper($input); } private static function field($field, $rowID, $field_name, $form_atomic_Cls_map, $formID, $error = null, $value = '') { $fh = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map); $img_url = BITFORMS_ASSET_URI . '/../static/currencies/'; $req = $fh->required(); $disabled = $fh->disabled(); $readonly = $fh->readonly(); $name = $fh->name(); $ph = $fh->placeholder(); $ariaDescribedBy = $fh->ariaDescribedBy(); $ariaRequired = $fh->ariaRequired(); // Get dynamic label ID to properly link the combobox to its label for screen readers $labelId = $fh->getLabelId(); $selectedFlagImage = ''; $tabIndx = isset($field->disabled) ? -1 : 0; $selectedCurrencyClearable = ''; $searchPlaceholder = ''; $searchClearable = ''; $options = ''; $readonlyCls = isset($field->readonly) ? 'readonly' : ''; $disabledCls = isset($field->disabled) ? 'disabled' : ''; $value = is_string($value) ? $value : ''; $numValue = preg_replace('/[^0-9.-]/', '', $value); $img = esc_url(includes_url('images/blank.gif')); if ($fh->property_exists_nested($field, 'config->selectedFlagImage', true)) { $selectedFlagImage = sprintf( '
', $fh->getAtomicCls('selected-currency-wrp'), $fh->getCustomAttributes('selected-currency-img'), $fh->getAtomicCls('selected-currency-img'), $fh->getCustomClasses('selected-currency-img'), $img ); } if ($fh->property_exists_nested($field, 'config->selectedCurrencyClearable', true)) { $selectedCurrencyClearable = sprintf( '', $fh->getCustomAttributes('input-clear-btn'), $fh->getAtomicCls('input-clear-btn'), $fh->getCustomClasses('input-clear-btn') ); } if ($fh->property_exists_nested($field, 'config->searchPlaceholder', '', 1)) { $searchPlaceholder = "placeholder='{$fh->esc_attr($field->config->searchPlaceholder)}'"; } if ($fh->property_exists_nested($field, 'config->searchClearable', true)) { $searchClearable = sprintf( '', $fh->getCustomAttributes('search-clear-btn'), $fh->getAtomicCls('search-clear-btn'), $fh->getCustomClasses('search-clear-btn') ); } // Container wrapper $html = sprintf( '
', $fh->getAtomicCls('currency-fld-container'), $fh->getCustomAttributes('currency-fld-wrp'), $fh->getAtomicCls('currency-fld-wrp'), $fh->getCustomClasses('currency-fld-wrp'), $disabled, $readonly ); // Hidden input $html .= sprintf( '', $fh->getCustomAttributes('currency-hidden-input'), $name, $req, $ariaRequired, $ariaDescribedBy, $fh->getAtomicCls('currency-hidden-input'), $disabled, $readonly, $fh->esc_attr($value) ); // Currency inner wrapper with dropdown $html .= sprintf( '
', $fh->getAtomicCls('currency-inner-wrp'), $fh->getCustomAttributes('dpd-wrp'), $fh->getAtomicCls('dpd-wrp'), $fh->getCustomClasses('dpd-wrp'), $tabIndx, $selectedFlagImage, $fh->getAtomicCls('dpd-down-btn') ); // Currency amount input $html .= sprintf( ' %7$s
', $fh->getCustomAttributes('currency-amount-input'), $fh->getAtomicCls('currency-amount-input'), $fh->getCustomClasses('currency-amount-input'), $ph, $tabIndx, $numValue, $selectedCurrencyClearable ); // Option wrapper with search $html .= sprintf( '
%15$s
', $fh->getCustomAttributes('option-wrp'), // 1 $fh->getAtomicCls('option-wrp'), // 2 $fh->getCustomClasses('option-wrp'), // 3 $fh->getAtomicCls('option-inner-wrp'), // 4 $fh->getCustomAttributes('option-search-wrp'), // 5 $fh->getAtomicCls('option-search-wrp'), // 6 $fh->getCustomClasses('option-search-wrp'), // 7 $fh->getCustomAttributes('opt-search-input'), // 8 $fh->getAtomicCls('opt-search-input'), // 9 $fh->getCustomClasses('opt-search-input'), // 10 $searchPlaceholder, // 11 $fh->getCustomAttributes('opt-search-icn'), // 12 $fh->getAtomicCls('opt-search-icn'), // 13 $fh->getCustomClasses('opt-search-icn'), // 14 $searchClearable // 15 ); // Option list and closing tags $html .= sprintf( '
    %4$s
', $fh->getCustomAttributes('option-list'), $fh->getAtomicCls('option-list'), $fh->getCustomClasses('option-list'), $options ); return $html; } }