From: Tim Otten Date: Sun, 31 Jan 2016 01:26:37 +0000 (-0700) Subject: CRM-17911 - Cxn.getlink API - Accept `page` or `page_name` X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b555239654ece381cf3e94e23546a6863fb3c33b;p=civicrm-core.git CRM-17911 - Cxn.getlink API - Accept `page` or `page_name` --- diff --git a/api/v3/Cxn.php b/api/v3/Cxn.php index 25d9ee9f5a..c080f70761 100644 --- a/api/v3/Cxn.php +++ b/api/v3/Cxn.php @@ -222,13 +222,14 @@ function _civicrm_api3_cxn_getlink_spec(&$spec) { $daoFields = CRM_Cxn_DAO_Cxn::fields(); $spec['app_guid'] = $daoFields['app_guid']; $spec['cxn_guid'] = $daoFields['cxn_guid']; - $spec['page'] = array( - 'name' => 'page', + $spec['page_name'] = array( + 'name' => 'page_name', 'type' => CRM_Utils_Type::T_STRING, 'title' => ts('Page Type'), 'description' => 'The type of page (eg "settings")', 'maxlength' => 63, 'size' => CRM_Utils_Type::HUGE, + 'api.aliases' => array('page'), ); } @@ -245,14 +246,14 @@ function civicrm_api3_cxn_getlink($params) { $cxnId = _civicrm_api3_cxn_parseCxnId($params); $appMeta = CRM_Cxn_BAO_Cxn::getAppMeta($cxnId); - if (empty($params['page']) || !is_string($params['page'])) { + if (empty($params['page_name']) || !is_string($params['page_name'])) { throw new API_Exception("Invalid page"); } /** @var \Civi\Cxn\Rpc\RegistrationClient $client */ $client = \Civi::service('cxn_reg_client'); return $client->call($appMeta, 'Cxn', 'getlink', array( - 'page' => $params['page'], + 'page' => $params['page_name'], )); } @@ -270,19 +271,6 @@ function civicrm_api3_cxn_getcfg($params) { 'siteCallbackUrl' => CRM_Cxn_BAO_Cxn::getSiteCallbackUrl(), ); return civicrm_api3_create_success($result); - - $cxnId = _civicrm_api3_cxn_parseCxnId($params); - $appMeta = CRM_Cxn_BAO_Cxn::getAppMeta($cxnId); - - if (empty($params['page']) || !is_string($params['page'])) { - throw new API_Exception("Invalid page"); - } - - /** @var \Civi\Cxn\Rpc\RegistrationClient $client */ - $client = \Civi\Core\Container::singleton()->get('cxn_reg_client'); - return $client->call($appMeta, 'Cxn', 'getlink', array( - 'page' => $params['page'], - )); } /**