From: Allen Shaw Date: Sun, 25 Sep 2016 21:42:27 +0000 (-0500) Subject: Fix CRM-19408: Create extension.getremote API X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c74a6c8f12ca49642b677a306287b78f6917dca8;p=civicrm-core.git Fix CRM-19408: Create extension.getremote API --- diff --git a/api/v3/Extension.php b/api/v3/Extension.php index 183af02e36..5670460550 100644 --- a/api/v3/Extension.php +++ b/api/v3/Extension.php @@ -341,6 +341,27 @@ function civicrm_api3_extension_get($params) { return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', array('id', 'key', 'status')); } +/** + * Get a list of remotely available extensions. + * + * @param array $params + * + * @return array + * API result + */ +function civicrm_api3_extension_getremote($params) { + $extensions = CRM_Extension_System::singleton()->getBrowser()->getExtensions(); + $result = array(); + $id = 0; + foreach ($extensions as $key => $obj) { + $info = array(); + $info['id'] = $id++; // backward compatibility with indexing scheme + $info = array_merge($info, (array) $obj); + $result[] = $info; + } + return _civicrm_api3_basic_array_get('Extension', $params, $result, 'id', CRM_Utils_Array::value('return', $params, array())); +} + /** * Determine the list of extension keys. *