From 2f7386456eeec4d3a0d162d52e6b79b185a20e45 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Thu, 6 Feb 2020 22:40:32 +0000 Subject: [PATCH] Don't duplicate code to add a radio element to quickform --- CRM/Core/BAO/CustomField.php | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 128c2a8841..e2573e0abe 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -780,25 +780,9 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { $qf->add('text', $elementName . '_to', ts('To'), $field->attributes); } else { - $choice = []; parse_str($field->attributes, $radioAttributes); $radioAttributes = array_merge($radioAttributes, $customFieldAttributes); - - foreach ($options as $v => $l) { - $choice[] = $qf->createElement('radio', NULL, '', $l, (string) $v, $radioAttributes); - } - $element = $qf->addGroup($choice, $elementName, $label); - $optionEditKey = 'data-option-edit-path'; - if (isset($selectAttributes[$optionEditKey])) { - $element->setAttribute($optionEditKey, $selectAttributes[$optionEditKey]); - } - - if ($useRequired && !$search) { - $qf->addRule($elementName, ts('%1 is a required field.', [1 => $label]), 'required'); - } - else { - $element->setAttribute('allowClear', TRUE); - } + $qf->addRadio($elementName, $label, $options, $radioAttributes, NULL, $useRequired); } break; -- 2.25.1