';
}
$groupId = $this->makeElementId($data, $form);
foreach ($formattedOptions as $index => $option) {
$quantityLabel = ArrayHelper::get($option,'quantiy_label');
if ($type == 'select') {
if (!$defaultValues && $index == 0) {
$checked = true;
} else {
$checked = in_array($option['value'], $defaultValues);
}
$optionAtts = $this->buildAttributes([
'value' => $option['label'],
'data-payment_value' => $option['value'],
'data-calc_value' => $option['value'],
'selected' => $checked,
'disabled' => ArrayHelper::get($option, 'disabled') ? 'disabled' : '',
'data-quantity_remaining' => ArrayHelper::get($option, 'quantity_remaining', false)
], $form);
$elMarkup .= '
';
continue;
}
$displayType = isset($data['settings']['display_type']) ? ' ff-el-form-check-' . $data['settings']['display_type'] : '';
$parentClass = "ff-el-form-check{$displayType}";
if (in_array($option['value'], $defaultValues)) {
$data['attributes']['checked'] = true;
$parentClass .= ' ff_item_selected';
} else {
$data['attributes']['checked'] = false;
}
if ($firstTabIndex) {
$data['attributes']['tabindex'] = $firstTabIndex;
$firstTabIndex = '-1';
}
$data['attributes']['class'] .= ' ff_payment_item';
$data['attributes']['value'] = $option['label'];
$data['attributes']['data-payment_value'] = $option['value'];
$data['attributes']['data-calc_value'] = ArrayHelper::get($option, 'value');
$data['attributes']['data-group_id'] = $groupId;
$data['attributes']['disabled'] = ArrayHelper::get($option, 'disabled') ? 'disabled' : '';
$data['attributes']['data-quantity_remaining'] = ArrayHelper::get($option, 'quantity_remaining', false);
$atts = $this->buildAttributes($data['attributes'], $form);
$id = $this->getUniqueid(str_replace(['[', ']'], ['', ''], $data['attributes']['name']));
if ($hasImageOption && !empty($option['image'])) {
$parentClass .= ' ff-el-image-holder';
}
$elMarkup .= "
";
// Here we can push the visual items
if ($hasImageOption && !empty($option['image'])) {
$elMarkup .= "";
}
$elMarkup .= "";
$elMarkup .= "
";
}
if ($type == 'select') {
$elMarkup .= '';
} else if ($hasImageOption) {
$elMarkup .= '
';
}
if($layoutClass = ArrayHelper::get($data, 'settings.layout_class')) {
$data['settings']['container_class'] = $data['settings']['container_class'].' '.$layoutClass;
}
$html = $this->buildElementMarkup($elMarkup, $data, $form);
$html = apply_filters_deprecated(
'fluentform_rendering_field_html_' . $elementName,
[
$html,
$data,
$form
],
FLUENTFORM_FRAMEWORK_UPGRADE,
'fluentform/rendering_field_html_' . $elementName,
'Use fluentform/rendering_field_html_' . $elementName . ' instead of fluentform_rendering_field_html_' . $elementName
);
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Content is escaped by the filter
echo apply_filters('fluentform/rendering_field_html_' . $elementName, $html, $data, $form);
}
}