Skip to content
Snippets Groups Projects
Commit f60289e9 authored by eileen's avatar eileen
Browse files

standardise naming of _spec functions & add support for 'id' as pseudonym of domain_id

parent f704dce7
Branches
Tags
No related merge requests found
......@@ -62,7 +62,7 @@ function civicrm_api3_setting_getfields($params) {
);
// find any supplemental information
if(CRM_Utils_Array::value('action',$params)){
$specFunction = 'civicrm_api3_setting_' . $params['action'] . '_spec';
$specFunction = '_civicrm_api3_setting_' . strtolower($params['action']) . '_spec';
if (function_exists($specFunction)) {
$specFunction($result);
}
......@@ -72,7 +72,7 @@ function civicrm_api3_setting_getfields($params) {
/*
* Alter metadata for getfields functions
*/
function civicrm_api3_setting_getfields_spec(&$params) {
function _civicrm_api3_setting_getfields_spec(&$params) {
$params['filters'] = array('title' => 'Fields you wish to filter by e.g. array("group_name" => "CiviCRM Preferences")');
$params['component_id'] = array('title' => 'id of relevant component');
$params['profile'] = array('title' => 'profile is passed through to hooks & added to cachestring');
......@@ -109,7 +109,7 @@ function civicrm_api3_setting_getdefaults(&$params){
*
* @param array $params parameters as passed to the API
*/
function civicrm_api3_setting_getdefaults_spec(&$params) {
function _civicrm_api3_setting_getdefaults_spec(&$params) {
$params['domain_id'] = array(
'api.default' => 'current_domain',
'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain
......@@ -140,7 +140,7 @@ function civicrm_api3_setting_revert(&$params){
/*
* Alter metadata for getfields functions
*/
function civicrm_api3_setting_revert_spec(&$params) {
function _civicrm_api3_setting_revert_spec(&$params) {
$params['name'] = array('title' => 'Setting Name belongs to');
$params['component_id'] = array('title' => 'id of relevant component');
$params['domain_id'] = array(
......@@ -173,7 +173,7 @@ function civicrm_api3_setting_fill(&$params){
/*
* Alter metadata for getfields functions
*/
function civicrm_api3_setting_fill_spec(&$params) {
function _civicrm_api3_setting_fill_spec(&$params) {
$params['name'] = array('title' => 'Setting Name belongs to');
$params['component_id'] = array('title' => 'id of relevant component');
$params['domain_id'] = array(
......@@ -204,7 +204,7 @@ function civicrm_api3_setting_create($params) {
*
* @param array $params parameters as passed to the API
*/
function civicrm_api3_setting_create_spec(&$params) {
function _civicrm_api3_setting_create_spec(&$params) {
$params['domain_id'] = array(
'api.default' => 'current_domain',
'description' => 'if you do not pass in a domain id this will default to the current domain
......@@ -236,7 +236,7 @@ function civicrm_api3_setting_get($params) {
*
* @param array $params parameters as passed to the API
*/
function civicrm_api3_setting_get_spec(&$params) {
function _civicrm_api3_setting_get_spec(&$params) {
$params['domain_id'] = array(
'api.default' => 'current_domain',
'description' => 'if you do not pass in a domain id this will default to the current domain'
......@@ -277,7 +277,7 @@ function civicrm_api3_setting_getvalue($params) {
*
* @param array $params parameters as passed to the API
*/
function civicrm_api3_setting_getvalue_spec(&$params) {
function _civicrm_api3_setting_getvalue_spec(&$params) {
$params['group'] = array(
'title' => 'Settings Group',
......@@ -303,8 +303,16 @@ function civicrm_api3_setting_getvalue_spec(&$params) {
/*
* Converts domain input into an array. If an array is passed in this is used, if 'all' is passed
* in this is converted to 'all arrays'
*
* Really domain_id should always be set but doing an empty check because at the moment
* using crm-editable will pass an id & default won't be applied
* we did talk about id being a pseudonym for domain_id in this api so applying it here
*/
function _civicrm_api3_setting_getDomainArray(&$params){
if(empty($params['domain_id']) && isset($params['id'])){
$params['domain_id'] = $params['id'];
}
if($params['domain_id'] == 'current_domain'){
$params['domain_id'] = CRM_Core_Config::domainID();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment