Usually it's safe to assume the `id_field` === "id", which is automatically returned
by APIv3. However in the case of looking up records by name, etc. we must ensure that value
gets returned.
'activity_type_id',
'subject',
'source_contact_id',
+ $request['id_field'],
+ $request['label_field'],
];
$request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra']));
$request['params']['options']['sort'] = 'activity_date_time DESC';
* @param array $request
*/
function _civicrm_api3_campaign_getlist_params(&$request) {
- $fieldsToReturn = ['title', 'campaign_type_id', 'status_id', 'start_date', 'end_date'];
+ $fieldsToReturn = [
+ 'title',
+ 'campaign_type_id',
+ 'status_id',
+ 'start_date',
+ 'end_date',
+ $request['id_field'],
+ $request['label_field'],
+ ];
$request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra']));
if (empty($request['params']['id'])) {
$request['params']['options']['sort'] = 'start_date DESC, title';
* @param array $request
*/
function _civicrm_api3_event_getlist_params(&$request) {
- $fieldsToReturn = ['start_date', 'event_type_id', 'title', 'summary'];
+ $fieldsToReturn = [
+ 'start_date',
+ 'event_type_id',
+ 'title',
+ 'summary',
+ $request['id_field'],
+ $request['label_field'],
+ ];
$request['params']['return'] = array_unique(array_merge($fieldsToReturn, $request['extra']));
$request['params']['options']['sort'] = 'start_date DESC';
if (empty($request['params']['id'])) {
* Array of parameters determined by getfields.
*/
function _civicrm_api3_membership_type_getlist_params(&$request) {
+ _civicrm_api3_generic_getlist_params($request);
if (!isset($request['params']['is_active']) && empty($request['params']['id'])) {
$request['params']['is_active'] = 1;
}
* 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']));
}