Skip to content

Commit

Permalink
Merge pull request #196 from colemanw/custom_ref_options
Browse files Browse the repository at this point in the history
Only show custom reference option if such a field exists
  • Loading branch information
colemanw authored Feb 1, 2019
2 parents bd5529f + 35b804f commit 1950aed
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions includes/contact_component.inc
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,18 @@ function _webform_edit_civicrm_contact($component) {
'#parents' => array('extra', 'default_relationship'),
);
}
$form['defaults']['default']['#options']['custom_ref'] = t('Custom reference field');
$form['defaults']['default_custom_ref'] = array(
'#type' => 'select',
'#title' => t('Specify Custom Field'),
'#options' => wf_crm_get_custom_ref_options(),
'#required' => TRUE,
'#default_value' => $component['extra']['default_custom_ref'],
'#parents' => array('extra', 'default_custom_ref'),
);
$custom_ref_options = wf_crm_get_custom_ref_options();
if ($custom_ref_options) {
$form['defaults']['default']['#options']['custom_ref'] = t('Custom reference field');
$form['defaults']['default_custom_ref'] = array(
'#type' => 'select',
'#title' => t('Specify Custom Field'),
'#options' => $custom_ref_options,
'#required' => TRUE,
'#default_value' => $component['extra']['default_custom_ref'],
'#parents' => array('extra', 'default_custom_ref'),
);
}

$case_count = isset($data['case']['number_of_case']) ? $data['case']['number_of_case'] : 0;
if ($case_count > 0) {
Expand Down

0 comments on commit 1950aed

Please sign in to comment.