From: Colby Warkentin Date: Tue, 23 Apr 2013 22:23:49 +0000 (-0700) Subject: CRM-10360 - REST API will now bootstrap when call submitted with entity/action params. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c5f77b4182c4c5cad5adeeb66c25a53712d9272d;p=civicrm-core.git CRM-10360 - REST API will now bootstrap when call submitted with entity/action params. ---------------------------------------- * CRM-10360: Hook doesn't run with v3 API extern REST interface http://issues.civicrm.org/jira/browse/CRM-10360 --- diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index f31f4bb9b1..27e21f06f8 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -644,6 +644,18 @@ class CRM_Utils_REST { $q = CRM_Utils_array::value('q', $_REQUEST); $args = explode('/', $q); + // If no 'q' parameter is provided, try to populate args + // with entity and action (API v3) + if ( empty($args) || $args[0] == '' ) { + $entity = CRM_Utils_array::value( 'entity', $_REQUEST ); + $action = CRM_Utils_array::value( 'action', $_REQUEST ); + if (($entity !== null) && ($action !== null)) { + $args[0] = 'civicrm'; + $args[1] = $entity; + $args[2] = $action; + } + } + // If the function isn't in the civicrm namespace or request // is for login or ping if (empty($args) || $args[0] != 'civicrm' ||