3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * This api exposes CiviCRM Grant records.
15 * @note Grant component must be enabled.
17 * @package CiviCRM_APIv3
21 * Create/update Grant.
23 * @param array $params
24 * Array per getfields metadata.
28 function civicrm_api3_grant_create($params) {
29 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'Grant');
33 * Adjust Metadata for Create action.
35 * The metadata is used for setting defaults, documentation & validation.
37 * @param array $params
38 * Array of parameters determined by getfields.
40 function _civicrm_api3_grant_create_spec(&$params) {
41 $params['contact_id']['api.required'] = 1;
42 $params['grant_type_id']['api.required'] = 1;
43 $params['status_id']['api.required'] = 1;
44 $params['amount_total']['api.required'] = 1;
45 $params['status_id']['api.aliases'] = ['grant_status'];
49 * Returns array of grants matching a set of one or more properties.
51 * @param array $params
52 * Array per getfields metadata.
55 * Array of matching grants
57 function civicrm_api3_grant_get($params) {
58 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params, TRUE, 'Grant');
62 * This method is used to delete an existing Grant.
64 * @param array $params
65 * Id of the Grant to be deleted is required.
70 function civicrm_api3_grant_delete($params) {
71 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);