* @param array $params
* array to be passed to function
*
- * @return array|int
+ * @return array|int|Civi\Api4\Generic\Result
*/
function civicrm_api(string $entity, string $action, array $params) {
return \Civi::service('civi_api_kernel')->runSafe($entity, $action, $params);
$removeIndexField = FALSE;
// If index field is not part of the select query, we add it here and remove it below (except for oddball "Setting" api)
- if ($indexField && !empty($params['select']) && is_array($params['select']) && $entity !== 'Setting' && !\Civi\Api4\Utils\SelectUtil::isFieldSelected($indexField, $params['select'])) {
+ if ($indexField && !empty($params['select']) && is_array($params['select']) && !($entity === 'Setting' && $action === 'get') && !\Civi\Api4\Utils\SelectUtil::isFieldSelected($indexField, $params['select'])) {
$params['select'][] = $indexField;
$removeIndexField = TRUE;
}