wrapper($input); } private static function field($field, $rowID, $form_atomic_Cls_map, $value) { $fieldHelpers = new ClassicFieldHelpers($field, $rowID, $form_atomic_Cls_map); $name = $fieldHelpers->name(); $req = $fieldHelpers->required(); $bfFrontendFormIds = FrontendHelpers::$bfFrontendFormIds; $contentCount = count($bfFrontendFormIds); $ratingOption = ''; $checkedIndex = ''; if (isset($field->opt)) { $defaultValue = isset($field->val) ? $field->val : ''; foreach ($field->opt as $key => $opt) { if ($defaultValue && $defaultValue === $opt->val) { $checkedIndex = $key; } elseif (isset($opt->check) && true === $opt->check) { $checkedIndex = $key; } } $checkedCls = null; foreach ($field->opt as $key => $opt) { $val = $opt->val; $img = $opt->img; $lbl = $opt->lbl; $checked = ''; // if ($defaultValue && $opt->val === $defaultValue) { // $checked = "checked='checked'"; // } elseif (isset($opt->check) && true === $opt->check) { // $checked = "checked='{$opt->check}'"; // } else { // $checked = ''; // } if ($defaultValue) { if ($opt->val === $defaultValue) { $checked = "checked='1'"; } } else { if (isset($opt->check) && true === $opt->check) { $checked = "checked='{$opt->check}'"; } else { $checked = ''; } } if (!empty($checkedIndex) && $key <= $checkedIndex) { $checkedCls = $rowID . '-rating-selected'; } else { $checkedCls = null; } $ratingOption .= sprintf( '', $fieldHelpers->getAtomicCls('rating-lbl'), $fieldHelpers->getCustomClasses('rating-lbl'), $rowID, $contentCount, $key, $fieldHelpers->getCustomAttributes('rating-lbl'), $fieldHelpers->getAtomicCls('rating-input'), $fieldHelpers->getCustomClasses('rating-input'), $name, $fieldHelpers->esc_attr($val), $fieldHelpers->esc_attr($lbl), $checked, $req, $fieldHelpers->getCustomAttributes('rating-input'), $fieldHelpers->getAtomicCls('rating-img'), $fieldHelpers->getCustomClasses('rating-img'), $checkedCls, $fieldHelpers->esc_url($img), $fieldHelpers->getCustomAttributes('rating-img') ); } } $labelId = $fieldHelpers->getLabelId(); $ariaDescribedBy = $fieldHelpers->ariaDescribedBy(); $ariaRequired = $fieldHelpers->ariaRequired(); return sprintf( '
%10$s
', $fieldHelpers->getCustomAttributes('inp-fld-wrp'), $fieldHelpers->getAtomicCls('inp-fld-wrp'), $fieldHelpers->getCustomClasses('inp-fld-wrp'), $fieldHelpers->getCustomAttributes('rating-wrp'), $fieldHelpers->getAtomicCls('rating-wrp'), $fieldHelpers->getCustomClasses('rating-wrp'), $labelId, $ariaDescribedBy, $ariaRequired, $ratingOption, $fieldHelpers->getAtomicCls('rating-msg'), $fieldHelpers->getCustomClasses('rating-msg'), $fieldHelpers->getCustomAttributes('rating-msg') ); } }