renderSection($fieldData); break; case 'sub_section': $fields = Arr::get($fieldData, 'fields', []); $atts = array_filter([ 'class' => 'fct_form_sub_section_wrapper ' . Arr::get($fieldData, 'wrapper_class', ''), 'id' => Arr::get($fieldData, 'id', '') ]); if ($fields) { ?>
> renderField($field); } echo '
'; } break; case 'text': case 'email': case 'tel': case 'number': $this->renderSingleLineInputField($fieldData); break; case 'textarea': $this->renderTextareaField($fieldData); break; case 'checkbox': $this->renderCheckboxInputField($fieldData); break; case 'select': $this->renderSelectField($fieldData); break; case 'address_select': $this->renderAddressSelect($fieldData); break; default: do_action('fluent_cart/render_custom_form_field', $fieldData); break; } } public function renderAddressSelect($fieldData = []) { (new AddressSelectRenderer( Arr::get($fieldData, 'options', []), Arr::get($fieldData, 'primary_address'), Arr::get($fieldData, 'requirements_fields'), Arr::get($fieldData, 'address_type') )) ->render(); } public function renderSection($sectionData = []) { if (empty($sectionData) || !is_array($sectionData)) { return; } $label = Arr::get($sectionData, 'heading', ''); $fields = Arr::get($sectionData, 'fields', []); $sectionId = Arr::get($sectionData, 'id', ''); $headingId = $sectionId ? $sectionId . '_heading' : ''; $wrapperAttributes = array_filter([ 'class' => 'fct_checkout_form_section', 'id' => $sectionId ]); if (!empty($label) && $headingId) { $wrapperAttributes['role'] = 'region'; $wrapperAttributes['aria-labelledby'] = $headingId; } if (!empty($sectionData['wrapper_atts'])) { $wrapperAttributes = wp_parse_args($sectionData['wrapper_atts'], $wrapperAttributes); } if (empty($fields)) { return; } ?>
data-fct-checkout-form-section>

>

renderField($field); } ?>
$type, 'class' => 'fct-input fct-input-' . $type, 'value' => Arr::get($fieldData, 'value', ''), 'placeholder' => Arr::get($fieldData, 'placeholder', ''), 'id' => $fieldId, 'name' => Arr::get($fieldData, 'name', ''), 'autocomplete' => Arr::get($fieldData, 'autocomplete', ''), 'disabled' => Arr::get($fieldData, 'disabled', '') === true ? 'disabled' : '', ]); // Add required and aria-required together if ($isRequired) { $inputAttributes['required'] = 'required'; $inputAttributes['aria-required'] = 'true'; } // Only add aria-label if it is not empty if (!empty($fieldData['aria-label'])) { $inputAttributes['aria-label'] = Arr::get($fieldData, 'aria-label', ''); } if (!empty($fieldData['extra_atts'])) { $inputAttributes = wp_parse_args($inputAttributes, $fieldData['extra_atts']); } $label = Arr::get($fieldData, 'label', ''); $wrapperAttributes = array_filter([ 'class' => 'fct_input_wrapper fct_input_wrapper_' . $type, 'id' => 'fct_wrapper_' . $fieldId ]); if (!empty($fieldData['wrapper_atts'])) { $wrapperAttributes = wp_parse_args($fieldData['wrapper_atts'], $wrapperAttributes); } ?>
> />
'textarea', 'class' => 'fct-input fct-input-textarea', 'placeholder' => Arr::get($fieldData, 'placeholder', ''), 'id' => $fieldId, 'name' => Arr::get($fieldData, 'name', ''), 'autocomplete' => Arr::get($fieldData, 'autocomplete', ''), 'disabled' => Arr::get($fieldData, 'disabled', '') === true ? 'disabled' : '', ]); // Add required and aria-required together if ($isRequired) { $inputAttributes['required'] = 'required'; $inputAttributes['aria-required'] = 'true'; } // Only add aria-label if it is not empty if (!empty($fieldData['aria-label'])) { $inputAttributes['aria-label'] = Arr::get($fieldData, 'aria-label', ''); } if (!empty($fieldData['extra_atts'])) { $inputAttributes = wp_parse_args($inputAttributes, $fieldData['extra_atts']); } $label = Arr::get($fieldData, 'label', ''); $wrapperAttributes = array_filter([ 'class' => 'fct_input_wrapper fct_input_wrapper_textarea', 'id' => 'fct_wrapper_' . $fieldId ]); if (!empty($fieldData['wrapper_atts'])) { $wrapperAttributes = wp_parse_args($fieldData['wrapper_atts'], $wrapperAttributes); } ?>
>
'checkbox', 'class' => 'fct-input fct-input-checkbox', 'id' => $fieldId, 'name' => Arr::get($fieldData, 'name', ''), 'value' => $checkboxValue, 'checked' => Arr::get($fieldData, 'value', '') == $checkboxValue ? 'checked' : '', 'disabled' => Arr::get($fieldData, 'disabled', '') === true ? 'disabled' : '', ]); // Add required and aria-required together if ($isRequired) { $inputAttributes['required'] = 'required'; $inputAttributes['aria-required'] = 'true'; } if (!empty($fieldData['extra_atts'])) { $inputAttributes = wp_parse_args($inputAttributes, $fieldData['extra_atts']); } $label = Arr::get($fieldData, 'label', ''); $wrapperAttributes = array_filter([ 'class' => 'fct_input_wrapper fct_input_wrapper_textarea', 'id' => 'fct_wrapper_' . $fieldId ]); if (!empty($fieldData['wrapper_atts'])) { $wrapperAttributes = wp_parse_args($fieldData['wrapper_atts'], $wrapperAttributes); } ?>
>
'fct-input fct-input-select', 'id' => $fieldId, 'name' => Arr::get($fieldData, 'name', ''), 'disabled' => Arr::get($fieldData, 'disabled', '') === true ? 'disabled' : '', ]); // Add required and aria-required together if ($isRequired) { $inputAttributes['required'] = 'required'; $inputAttributes['aria-required'] = 'true'; } if (!empty($fieldData['extra_atts'])) { $inputAttributes = wp_parse_args($inputAttributes, $fieldData['extra_atts']); } $label = Arr::get($fieldData, 'label', ''); $options = Arr::get($fieldData, 'options', []); $wrapperAttributes = array_filter([ 'class' => 'fct_input_wrapper fct_input_wrapper_select', 'id' => 'fct_wrapper_' . $fieldId ]); if (!empty($fieldData['wrapper_atts'])) { $wrapperAttributes = wp_parse_args($fieldData['wrapper_atts'], $wrapperAttributes); } $value = Arr::get($fieldData, 'value', ''); ?>
>