Ensure APIv3 EntityRef fields always return the value of the `id_field`.
[civicrm-core.git] / ext / afform / core / api / v3 / Afform.php
index 41c20c63a48703177bf26f001444faec0b68fb00..fda6038cb506502cd02ccb7ea772f1b0e427dbe0 100644 (file)
@@ -88,7 +88,14 @@ function _civicrm_api3_afform_get_spec(&$fields) {
  *   API request.
  */
 function _civicrm_api3_afform_getlist_params(&$request) {
-  $fieldsToReturn = ['name', 'title', 'type', 'description'];
+  $fieldsToReturn = [
+    'name',
+    'title',
+    'type',
+    'description',
+    $request['id_field'],
+    $request['label_field'],
+  ];
   $request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra']));
 }