From 8404c4e9467e3ff07c61dbf53a474f1fa55ce9f8 Mon Sep 17 00:00:00 2001 From: Marc Michalsky forumZFD Date: Thu, 17 Dec 2020 10:51:08 +0100 Subject: [PATCH] give back associative array with results sorted by their id's --- api/v3/TwingleForm/Get.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/api/v3/TwingleForm/Get.php b/api/v3/TwingleForm/Get.php index c24a61a..b09a946 100644 --- a/api/v3/TwingleForm/Get.php +++ b/api/v3/TwingleForm/Get.php @@ -75,8 +75,7 @@ function civicrm_api3_twingle_form_Get(array $params): array { if ($result['is_error'] == 0) { foreach($result['values'] as $value) { - array_push( - $returnValues, + $returnValues[$value['id']] = [ 'id' => $value['id'], 'twingle_project_id' => $value[$custom_field_mapping['twingle_project_id']], @@ -85,8 +84,7 @@ function civicrm_api3_twingle_form_Get(array $params): array { 'project_type' => $value[$custom_field_mapping['twingle_project_type']], 'embed_code' => $value[$custom_field_mapping['twingle_project_widget']], 'counter' => $value[$custom_field_mapping['twingle_project_counter']] - ] - ); + ]; } return civicrm_api3_create_success($returnValues, $params, 'TwingleForm', 'Get'); }