function civicrm_api3_generic_getList($apiRequest) {
$entity = _civicrm_api_get_entity_name_from_camel($apiRequest['entity']);
$request = $apiRequest['params'];
-
+
_civicrm_api3_generic_getList_defaults($entity, $request);
-
+
// Hey api, would you like to format the search params?
$fnName = "_civicrm_api3_{$entity}_getlist_params";
$fnName = function_exists($fnName) ? $fnName : '_civicrm_api3_generic_getlist_params';
'extra' => array(),
);
// Find main field from meta
- foreach (array('sort_name', 'title', 'label', 'name') as $field) {
+ foreach (array('sort_name', 'title', 'label', 'name', 'subject') as $field) {
if (isset($fields[$field])) {
$defaults['label_field'] = $defaults['search_field'] = $field;
break;
}
// When looking up a field e.g. displaying existing record
if (!empty($request['id'])) {
- if (is_string($request['id']) && strpos(',', $request['id'])) {
- $request['id'] = explode(',', $request['id']);
+ if (is_string($request['id']) && strpos($request['id'], ',')) {
+ $request['id'] = explode(',', trim($request['id'], ', '));
}
// Don't run into search limits when prefilling selection
- unset($params['options']['limit'], $params['options']['offset'], $request['params']['options']['limit'], $request['params']['options']['offset']);
+ $params['options']['limit'] = NULL;
+ unset($params['options']['offset'], $request['params']['options']['limit'], $request['params']['options']['offset']);
$params[$request['id_field']] = is_array($request['id']) ? array('IN' => $request['id']) : $request['id'];
}
$request['params'] += $params;