// If we are doing quicksearch by a field other than name, make sure that field is added to results
if (!empty($params['field_name'])) {
$field_name = CRM_Utils_String::munge($params['field_name']);
+ // there is no good reason to request api_key via getquick
+ if ($field_name == 'api_key') {
+ throw new API_Exception('Illegal value "api_key" for parameter "field_name"');
+ }
// Unique name contact_id = id
if ($field_name == 'contact_id') {
$field_name = 'id';
// Contact's based of relationhip type
$relType = NULL;
if (!empty($params['rel'])) {
- $relation = explode('_', CRM_Utils_Array::value('rel', $params));
+ $relation = explode('_', $params['rel']);
$relType = CRM_Utils_Type::escape($relation[0], 'Integer');
$rel = CRM_Utils_Type::escape($relation[2], 'String');
}
while ($dao->fetch()) {
$t = ['id' => $dao->id];
foreach ($as as $k) {
- $t[$k] = isset($dao->$k) ? $dao->$k : '';
+ $t[$k] = $dao->$k ?? '';
}
$t['data'] = $dao->data;
// Replace keys with values when displaying fields from an option list
$data['description'][] = implode(' ', $address);
}
if (!empty($request['image_field'])) {
- $data['image'] = isset($row[$request['image_field']]) ? $row[$request['image_field']] : '';
+ $data['image'] = $row[$request['image_field']] ?? '';
}
else {
$data['icon_class'] = $row['contact_type'];