use less variables

This commit is contained in:
Marc Michalsky forumZFD 2020-12-10 15:18:26 +01:00
parent 1908a5b656
commit 5a09523af7
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -58,14 +58,11 @@ function civicrm_api3_twingle_form_Get(array $params) {
// Get custom fields // Get custom fields
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping(); $custom_field_mapping = Cache::getInstance()->getCustomFieldMapping();
$cf_twingle_project_id = $custom_field_mapping['twingle_project_id'];
$cf_twingle_project_type = $custom_field_mapping['twingle_project_type'];
$cf_twingle_project_widget = $custom_field_mapping['twingle_project_widget'];
$cf_twingle_project_counter = $custom_field_mapping['twingle_project_counter'];
// Replace twingle_project_type key with custom field name // Replace twingle_project_type key with custom field name
if (key_exists('twingle_project_type', $params)) { if (key_exists('twingle_project_type', $params)) {
$params[$cf_twingle_project_type] = $params['twingle_project_type']; $params[$custom_field_mapping['twingle_project_type']] =
$params['twingle_project_type'];
unset($params['twingle_project_type']); unset($params['twingle_project_type']);
} }
@ -87,12 +84,12 @@ function civicrm_api3_twingle_form_Get(array $params) {
$returnValues, $returnValues,
[ [
'id' => $value['id'], 'id' => $value['id'],
'twingle_project_id' => $value[$cf_twingle_project_id], 'twingle_project_id' => $value[$custom_field_mapping['twingle_project_id']],
'title' => $value['title'], 'title' => $value['title'],
'name' => $value['name'], 'name' => $value['name'],
'project_type' => $value[$cf_twingle_project_type], 'project_type' => $value[$custom_field_mapping['twingle_project_type']],
'embed_code' => $value[$cf_twingle_project_widget], 'embed_code' => $value[$custom_field_mapping['twingle_project_widget']],
'counter' => $value[$cf_twingle_project_counter] 'counter' => $value[$custom_field_mapping['twingle_project_counter']]
] ]
); );
} }