Merge pull request #21006 from deb1990/rename-pdf-file
[civicrm-core.git] / api / api.php
index 795d3c0a341b99190b3338fe4d58770cf1f13e3c..9ed9747dd0ca0b672fac76462c2f0f9ab911e6b2 100644 (file)
@@ -16,7 +16,7 @@
  * @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);
@@ -64,7 +64,7 @@ function civicrm_api4(string $entity, string $action, array $params = [], $index
   $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;
   }