CRM-17860 - TransactionalInterface - Docs
[civicrm-core.git] / api / api.php
index 4f53c542fc0324b54e6361ee65a70ba28f963cc5..e20c451d8f205a5e94ff8627d5da11049e0ccfdb 100644 (file)
@@ -20,7 +20,7 @@
  * @return array|int
  */
 function civicrm_api($entity, $action, $params, $extra = NULL) {
-  return \Civi\Core\Container::singleton()->get('civi_api_kernel')->run($entity, $action, $params, $extra);
+  return \Civi::service('civi_api_kernel')->run($entity, $action, $params, $extra);
 }
 
 /**
@@ -158,6 +158,10 @@ function _civicrm_api_replace_variables(&$params, &$parentResult, $separator = '
           $count = count($stringParts);
         }
       }
+      // CRM-16168 If we have failed to swap it out we should unset it rather than leave the placeholder.
+      if (substr($params[$field], 0, 6) == '$value') {
+        $params[$field] = NULL;
+      }
     }
   }
 }