Merge pull request #6363 from civicrm/CRM-16944
[civicrm-core.git] / api / v3 / Constant.php
index e0573f6c40b0bf1f631a337454388885dad8ca2c..316342e6e480a69a0c7f051efbf01bee68e54a95 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  * CiviCRM APIv3 pseudoconstants
  *
  * @deprecated
+ *   The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.
  * @package CiviCRM_APIv3
- * @subpackage API_Constant
- * @copyright CiviCRM LLC (c) 2004-2014
- * @version $Id: Constant.php 30171 2010-10-14 09:11:27Z mover $
  */
 
 /**
+ * Declare deprecated api entity.
+ *
  * @deprecated api notice
  * @return string
  *   to indicate this entire api entity is deprecated
  */
 function _civicrm_api3_constant_deprecation() {
-  return 'The constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.';
+  return 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.';
 }
 
 /**
+ * Get constant values (deprecated).
+ *
  * @deprecated as of CiviCRM 4.4.
  * It's recommended to use the api getoptions action instead
  *
- * @param  string  Name of a public static method of
- *                  CRM_Core_PseudoConstant: one of
- *  <ul>
- *    <li>activityStatus</li>
- *    <li>activityType</li>
- *    <li>addressee</li>
- *    <li>allGroup</li>
- *    <li>country</li>
- *    <li>countryIsoCode</li>
- *    <li>county</li>
- *    <li>currencyCode</li>
- *    <li>currencySymbols</li>
- *    <li>customGroup</li>
- *    <li>emailGreeting</li>
- *    <li>fromEmailAddress</li>
- *    <li>gender</li>
- *    <li>group</li>
- *    <li>groupIterator</li>
- *    <li>honor</li>
- *    <li>IMProvider</li>
- *    <li>individualPrefix</li>
- *    <li>individualSuffix</li>
- *    <li>locationType</li>
- *    <li>locationVcardName</li>
- *    <li>mailProtocol</li>
- *    <li>mappingTypes</li>
- *    <li>paymentProcessor</li>
- *    <li>paymentProcessorType</li>
- *    <li>pcm</li>
- *    <li>phoneType</li>
- *    <li>postalGreeting</li>
- *    <li>priority</li>
- *    <li>relationshipType</li>
- *    <li>stateProvince</li>
- *    <li>stateProvinceAbbreviation</li>
- *    <li>stateProvinceForCountry</li>
- *    <li>staticGroup</li>
- *    <li>tag</li>
- *    <li>tasks</li>
- *    <li>ufGroup</li>
- *    <li>visibility</li>
- *    <li>worldRegion</li>
- *    <li>wysiwygEditor</li>
- *  </ul>
+ * @param array $params
+ *  Name of a public static method of
+ *  CRM_Core_PseudoConstant: one of
+ *    activityStatus
+ *    activityType
+ *    addressee
+ *    allGroup
+ *    country
+ *    countryIsoCode
+ *    county
+ *    currencyCode
+ *    currencySymbols
+ *    customGroup
+ *    emailGreeting
+ *    fromEmailAddress
+ *    gender
+ *    group
+ *    groupIterator
+ *    honor
+ *    IMProvider
+ *    individualPrefix
+ *    individualSuffix
+ *    locationType
+ *    locationVcardName
+ *    mailProtocol
+ *    mappingTypes
+ *    paymentProcessor
+ *    paymentProcessorType
+ *    pcm
+ *    phoneType
+ *    postalGreeting
+ *    priority
+ *    relationshipType
+ *    stateProvince
+ *    stateProvinceAbbreviation
+ *    stateProvinceForCountry
+ *    staticGroup
+ *    tag
+ *    tasks
+ *    ufGroup
+ *    visibility
+ *    worldRegion
+ *    wysiwygEditor
+ *
  * @return array
- * @example ConstantGet.php
- *  {@getfields constant_get}
  */
 function civicrm_api3_constant_get($params) {
 
@@ -124,18 +124,20 @@ function civicrm_api3_constant_get($params) {
       //@TODO XAV take out the param the COOKIE, Entity, Action and so there are only the "real param" in it
       //$values = call_user_func_array( array( $className, $name ), $params );
     }
-    return civicrm_api3_create_success($values, $params, 'constant');
+    return civicrm_api3_create_success($values, $params, 'Constant');
   }
   else {
     $values = call_user_func(array('CRM_Utils_PseudoConstant', 'getConstant'), $name);
     if (!empty($values)) {
-      return civicrm_api3_create_success($values, $params, 'constant');
+      return civicrm_api3_create_success($values, $params, 'Constant');
     }
   }
   return civicrm_api3_create_error('Unknown civicrm constant or method not callable');
 }
 
 /**
+ * Adjust metadata for constant get action.
+ *
  * @param array $params
  */
 function _civicrm_api3_constant_get_spec(&$params) {
@@ -182,12 +184,13 @@ 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),
+      'type' => CRM_Utils_Type::T_STRING,
+    ),
   );
 }