X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FConstant.php;h=1b7363e4b01e811f91d847472f21ebcf4897f0de;hb=abb4c5978811c3463251e4d0ebde5d3db4c0d34a;hp=9b4d1c225a255b08d1336f390c8090e7bf180588;hpb=95ca1e4e775ce88e3f371abe8390a3526ba537e7;p=civicrm-core.git diff --git a/api/v3/Constant.php b/api/v3/Constant.php index 9b4d1c225a..1b7363e4b0 100644 --- a/api/v3/Constant.php +++ b/api/v3/Constant.php @@ -1,8 +1,7 @@ *
  • activityStatus
  • @@ -92,9 +97,8 @@ function _civicrm_api3_constant_deprecation() { *
  • worldRegion
  • *
  • wysiwygEditor
  • * + * * @return array - * @example ConstantGet.php - * {@getfields constant_get} */ function civicrm_api3_constant_get($params) { @@ -103,7 +107,6 @@ function civicrm_api3_constant_get($params) { //ie $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name); // once tests are 100% can try removing the first block & a similar block from Generic:getoptions - // Whitelist approach is safer $allowedClasses = array( 'CRM_Core_PseudoConstant', @@ -127,9 +130,9 @@ function civicrm_api3_constant_get($params) { } return civicrm_api3_create_success($values, $params, 'constant'); } - else{ + else { $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name); - if(!empty($values)){ + if (!empty($values)) { return civicrm_api3_create_success($values, $params, 'constant'); } } @@ -137,6 +140,8 @@ function civicrm_api3_constant_get($params) { } /** + * Adjust metadata for constant get action. + * * @param array $params */ function _civicrm_api3_constant_get_spec(&$params) { @@ -183,13 +188,12 @@ function _civicrm_api3_constant_get_spec(&$params) { 'worldRegion', 'wysiwygEditor', ); - $params = (array - ('name' => array( + $params = array( + 'name' => array( 'title' => 'Constant Name', 'name' => 'name', 'api.required' => 1, - 'options' => array_combine($options, $options) - )) + 'options' => array_combine($options, $options), + ), ); } -