}
/**
+ * Get extra parameters.
+ *
* @return array
*/
public function getExtraParams() {
}
/**
+ * Get error codes.
+ *
* @return array
*/
public function getErrorCodes() {
private $extraParams = array();
/**
+ * Class constructor.
+ *
* @param string $message
* The human friendly error message.
* @param mixed $error_code
}
/**
+ * Get extra parameters.
+ *
* @return array
*/
public function getExtraParams() {
}
/**
- * Call getfields from api wrapper. This function ensures that settings that
+ * Call getfields from api wrapper.
+ *
+ * This function ensures that settings that
* could alter getfields output (e.g. action for all api & profile_id for
* profile api ) are consistently passed in.
*
* @todo other output modifiers include contact_type
*
* @param array $apiRequest
+ *
* @return array
* getfields output
*/
}
/**
- * Convert possibly camel name to underscore separated entity name
+ * Convert possibly camel name to underscore separated entity name.
*
* @param string $entity
* Entity name in various formats e.g. Contribution, contribution,
* OptionValue, option_value, UFJoin, uf_join.
+ *
* @return string
* Entity name in underscore separated format.
*
}
/**
- * Having a DAO object find the entity name
+ * Having a DAO object find the entity name.
+ *
* @param object $bao
* DAO being passed in.
+ *
* @return string
*/
function _civicrm_api_get_entity_name_from_dao($bao) {
class civicrm_api3 {
/**
+ * Class constructor.
+ *
* @param array $config API configuration.
*/
public function __construct($config = NULL) {
}
/**
+ * Convert to string.
+ *
* @return string
*/
public function __toString() {
}
/**
- * Perform action
+ * Perform action.
+ *
* @param $action
* @param $params
+ *
* @return bool
*/
public function __call($action, $params) {
}
/**
- * As of PHP 5.3.0
+ * As of PHP 5.3.0.
+ *
* @param $name
* @param $arguments
*/
}
/**
- * Call via rest
+ * Call via rest.
+ *
* @param $entity
* @param $action
* @param array $params
+ *
* @return \stdClass
*/
public function remoteCall($entity, $action, $params = array()) {
}
/**
+ * Call api function.
+ *
* @param $entity
* @param string $action
* @param array $params
}
/**
+ * Is this an error.
+ *
* @return bool
*/
public function is_error() {
* Check if var is set.
*
* @param string $name
+ *
* @return bool
*/
public function is_set($name) {
* Get object.
*
* @param string $name
+ *
* @return $this
*/
public function __get($name) {
function _civicrm_api3_action_schedule_create_spec(&$params) {
$params['title']['api.required'] = TRUE;
$params['mapping_id']['api.required'] = TRUE;
- // $params['entity_status']['api.required'] = TRUE;
$params['entity_value']['api.required'] = TRUE;
}
*/
/**
- * Add a record relating a contact with an activity.
+ * Add a record relating a contact with an activity.
*
* @param array $params
*
}
/**
- * Deletes an existing ActivityContact record
+ * Delete an existing ActivityContact record.
*
* @param array $params
*
* @subpackage API_Attachment
* @copyright CiviCRM LLC (c) 2004-2014
* $Id: $
- *
*/
/**
}
/**
+ * Get attachment.
+ *
* @param array $params
+ *
* @return array
* per APIv3
* @throws API_Exception validation errors
*
* @param array $params
*
- * @return array (0 => int $id, 1 => array $file, 2 => array $entityFile, 3 => string $name, 4 => string $content,
+ * @return array
+ * (0 => int $id, 1 => array $file, 2 => array $entityFile, 3 => string $name, 4 => string $content,
* 5 => string $moveFile, 6 => $isTrusted, 7 => bool $returnContent)
* - array $file: whitelisted fields that can pass through directly to civicrm_file
* - array $entityFile: whitelisted fields that can pass through directly to civicrm_entity_file
* @throws API_Exception
* @return array
* API result array
- *
*/
function civicrm_api3_case_type_create($params) {
civicrm_api3_verify_mandatory($params, _civicrm_api3_get_DAO(__FUNCTION__));
*/
/**
+ * Declare deprecated api entity.
+ *
* @deprecated api notice
* @return string
* to indicate this entire api entity is deprecated
}
/**
+ * Get constant values (deprecated).
+ *
* @deprecated as of CiviCRM 4.4.
* It's recommended to use the api getoptions action instead
*
}
/**
+ * Adjust metadata for constant get action.
+ *
* @param array $params
*/
function _civicrm_api3_constant_get_spec(&$params) {
function _civicrm_api3_contact_getlist_output($result, $request) {
$output = array();
if (!empty($result['values'])) {
- $addressFields = array_intersect(array('street_address', 'city', 'state_province', 'country'), $request['params']['return']);
+ $addressFields = array_intersect(array(
+ 'street_address',
+ 'city',
+ 'state_province',
+ 'country',
+ ),
+ $request['params']['return']);
foreach ($result['values'] as $row) {
$data = array(
'id' => $row[$request['id_field']],
* The main purpose of the API is to provide integrators a level of stability not provided by
* the core code or schema - this means we have to provide support for api calls (where possible)
* across schema changes.
+ *
* @param array $params
*/
function _civicrm_api3_contribution_create_legacy_support_45(&$params) {
*
* As of v4.4 we support multiple soft credit, so now contribution returns array with 'soft_credit' as key
* but we still return first soft credit as a part of contribution array
+ *
* @param $contribution
*/
function _civicrm_api3_format_soft_credit(&$contribution) {
}
/**
- * Submit a contribution_page.
+ * Submit a contribution_page.
*
* @param array $params
* Array per getfields metadata.
* @throws Exception
* @return array
* ['values' => TRUE] or ['is_error' => 1, 'error_message' => 'what went wrong']
- *
*/
function civicrm_api3_custom_value_create($params) {
// @todo it's not clear where the entity_table is used as CRM_Core_BAO_CustomValueTable::setValues($create)
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
* @subpackage API_Activity
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id: Activity.php 30486 2010-11-02 16:12:09Z shot $
- *
*/
}
/**
- * Delete an existing dashboard-contact
+ * Delete an existing dashboard-contact.
*
* This method is used to delete any existing dashboard-board. the id of the dashboard-contact
* is required field in $params array
*
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
*
* @copyright CiviCRM LLC (c) 2004-2014
* @version $Id$
- *
*/
/**
- * Install an extension
+ * Install an extension.
*
* @param array $params
* Input parameters.
}
/**
- * Enable an extension
+ * Enable an extension.
*
* @param array $params
* Input parameters.
}
/**
- * Uninstall an extension,
+ * Uninstall an extension.
*
* @param array $params
* Input parameters.
}
/**
- * Download and install an extension
+ * Download and install an extension.
*
* @param array $params
* Input parameters.
}
/**
- * Download and install an extension
+ * Download and install an extension.
*
* @param array $params
* Input parameters.
*
* @return array
* API result
- * @example ExtensionRefresh.php
- *
*/
function civicrm_api3_extension_refresh($params) {
$defaults = array('local' => TRUE, 'remote' => TRUE);
}
/**
+ * Get metadata.
+ *
* Function fills the 'options' array on the metadata returned by getfields if
* 1) the param option 'get_options' is defined - e.g. $params['options']['get_options'] => array('custom_1)
* (this is passed in as the $fieldsToResolve array)
}
/**
- * modify metadata
+ * Adjust metadata.
+ *
* @param array $params
*/
function _civicrm_api3_group_contact_delete_spec(&$params) {
}
/**
+ * Group contact helper function.
*
* @param array $params
* @param string $op
}
/**
+ * Update group contact status.
+ *
* @deprecated - this should be part of create but need to know we aren't missing something
+ *
* @param array $params
+ *
* @return bool
* @throws \API_Exception
*/
}
/**
+ * Deprecated function notices.
+ *
* @deprecated api notice
* @return array
* Array of deprecated actions
* Array.
*
* @return array
- *
*/
function civicrm_api3_group_organization_create($params) {
* Create or update a line_item.
*
* @param array $params
- * Associative array of property.
- * name/value pairs to insert in new 'line_item'
- * @example LineItemCreate.php Std Create example
+ * Array of property name/value pairs to insert in new 'line_item'
*
* @return array
* api result array
$updateParams = array();
$updateParams['id'] = $params['id'];
- // the BAO will autocreate the job
- $updateParams['api.mailing_job.create'] = 0; // note: exact match to API default
+ // The BAO will auto-create the job - note: exact match to API default.
+ $updateParams['api.mailing_job.create'] = 0;
- // note: we'll pass along scheduling/approval fields, but they may get ignored
- // if we don't have permission
+ // Note: we'll pass along scheduling/approval fields, but they may get ignored
+ // if we don't have permission.
if (isset($params['scheduled_date'])) {
$updateParams['scheduled_date'] = $params['scheduled_date'];
$updateParams['scheduled_id'] = CRM_Core_Session::getLoggedInContactID();
* Handle a get event.
*
* @param array $params
+ *
* @return array
*/
function civicrm_api3_mailing_a_b_get($params) {
/**
* Save a mailing_component.
+ *
* @param array $params
*
* @throws API_Exception
* Get mailing event queue record.
*
* @param array $params
+ *
* @return array
*/
function civicrm_api3_mailing_event_queue_get($params) {
}
/**
- * Handle a subscription event
+ * Handle a subscription event.
+ *
* @deprecated
*
* @param array $params
}
/**
+ * Create mailing group.
+ *
* @param array $params
+ *
* @return array
* @throws \API_Exception
*/
}
/**
+ * Get mailing group.
+ *
* @param array $params
*
* @return array
}
/**
+ * Get metadata for mailing group functions.
+ *
* @param array $params
*
* @return array
}
/**
- * Create a Contact Membership
+ * Create a Contact Membership.
*
* This API is used for creating a Membership for a contact.
* Required parameters : membership_type_id and status_id.
);
}
/**
- * Adjust Metadata for Get action
+ * Adjust Metadata for Get action.
*
* The metadata is used for setting defaults, documentation & validation.
*
}
/**
+ * Perform api v2 custom behaviour.
+ *
* When we copied apiv3 from api v2 we brought across some custom behaviours - in the case of
* membership a complicated return array is constructed. The original
* behaviour made contact_id a required field. We still need to keep this for v3 when contact_id
* Required parameters : id of a membership status
*
* @param array $params
- * An associative array of name/value property values of civicrm_membership_status.
+ * Array of name/value property values of civicrm_membership_status.
+ *
* @deprecated - should just use create
*
* @return array
}
/**
+ * Delete message template.
+ *
* @param array $params
*
* @return bool
*/
/**
- * Create a Event Participant Payment
+ * Create a Event Participant Payment.
*
* This API is used for creating a Participant Payment of Event.
* Required parameters : participant_id, contribution_id.
$fieldName = str_replace('url', 'URL', $fieldName);
return str_replace('primary', 'Primary', $fieldName);
}
+
/**
- * metadata for submit action
+ * Metadata for submit action.
+ *
* @param array $params
* @param array $apirequest
*/
*
* @return array
* Updated Contact/ Activity object|CRM_Error
- *
- *
*/
function civicrm_api3_profile_set($params) {
return civicrm_api3('profile', 'submit', $params);
}
/**
- * Here we will build up getfields type data for all the fields in the profile. Because the integration with the
- * form layer in core is so hard-coded we are not going to attempt to re-use it
+ * Here we will build up getfields type data for all the fields in the profile.
+ *
+ * Because the integration with the form layer in core is so hard-coded we are not going to attempt to re-use it
* However, as this function is unit-tested & hence 'locked in' we can aspire to extract sharable
* code out of the form-layer over time.
*
*
* @return array
* API Result Array
- *
*/
function civicrm_api3_relationship_delete($params) {
* @see _civicrm_api3_generic_getlist_defaults
*
* @param array $request
+ *
* @return array
*/
function _civicrm_api3_relationship_type_getlist_defaults($request) {
}
/**
- * Deletes an existing ReportInstance
+ * Deletes an existing ReportInstance.
*
* @param array $params
*
return civicrm_api3_create_success($stats, $params, 'report_template', 'getstatistics', CRM_Core_DAO::$_nullObject, $metadata);
}
/**
- * Retrieve rows from a report template.
+ * Adjust metadata for template getrows action.
*
* @param array $params
* Input parameters.
- *
- * @return void
- * details of found instances
*/
function _civicrm_api3_report_template_getrows_spec(&$params) {
$params['report_id'] = array(
}
/**
- * Alter metadata for getfields functions
+ * Alter metadata for getfields functions.
+ *
* @param array $params
*/
function _civicrm_api3_setting_revert_spec(&$params) {
$params['component_id'] = array('title' => 'id of relevant component');
$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
- an array or "all" are acceptable values for multiple domains',
+ 'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the current domain'
+ . ' an array or "all" are acceptable values for multiple domains',
'title' => 'Setting Domain',
);
}
'api.default' => 'current_domain',
'title' => 'Setting Domain',
'description' => 'Defaults may differ by domain - if you do not pass in a domain id this will default to the '
- . 'current domain, an array or "all" are acceptable values for multiple domains',
+ . 'current domain, an array or "all" are acceptable values for multiple domains',
);
}
}
/**
- * Get the list of signatories
+ * Get the list of signatories.
+ *
* @deprecated - api currently not supported
*
* @param array $params
}
/**
+ * Count survey respondents.
+ *
* @deprecated - api currently not supported
+ *
* @param array $params
* @return array
*/
$params['title']['api.required'] = 1;
$params['is_active']['api.default'] = 1;
$params['is_update_dupe']['api.default'] = 1;
- $params['created_id']['api.default'] = 'user_contact_id';//the current user
+ // Default to the logged in user.
+ $params['created_id']['api.default'] = 'user_contact_id';
$params['created_date']['api.default'] = 'now';
}
+
/**
* Use this API to create a new group.
*
* Deletes an existing Website.
*
* @todo convert to using Basic delete - BAO function non standard
+ *
* @param array $params
*
* @return array