Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
a30c801b TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | ||
13 | /** | |
c28e1768 | 14 | * This api exposes CiviCRM price set fields. |
6a488035 | 15 | * |
244bbdd8 CW |
16 | * PriceSets contain PriceFields, which may contain PriceFieldValues. |
17 | * Each has its own api. | |
18 | * Use chaining to create a PriceSet and associated PriceFields and values in one api call. | |
19 | * | |
6a488035 | 20 | * @package CiviCRM_APIv3 |
6a488035 TO |
21 | */ |
22 | ||
23 | /** | |
2e66abf8 | 24 | * Create or update a price_field. |
6a488035 | 25 | * |
cf470720 | 26 | * @param array $params |
c28e1768 | 27 | * name/value pairs to insert in new 'price_field' |
6a488035 | 28 | * |
a6c01b45 | 29 | * @return array |
72b3a70c | 30 | * api result array |
6a488035 TO |
31 | */ |
32 | function civicrm_api3_price_field_create($params) { | |
ddaf2161 | 33 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'PriceField'); |
6a488035 | 34 | } |
11e09c59 TO |
35 | |
36 | /** | |
0aa0303c EM |
37 | * Adjust Metadata for Create action. |
38 | * | |
39 | * The metadata is used for setting defaults, documentation & validation. | |
6a488035 | 40 | * |
cf470720 | 41 | * @param array $params |
b081365f | 42 | * Array of parameters determined by getfields. |
6a488035 TO |
43 | */ |
44 | function _civicrm_api3_price_field_create_spec(&$params) { | |
291ebece | 45 | $params['label']['api.required'] = TRUE; |
6a488035 TO |
46 | } |
47 | ||
48 | /** | |
2e66abf8 | 49 | * Returns array of price_fields matching a set of one or more group properties. |
6a488035 | 50 | * |
cf470720 TO |
51 | * @param array $params |
52 | * Array of one or more valid property_name=>value pairs. If $params is set. | |
16b10e64 | 53 | * as null, all price_fields will be returned (default limit is 25) |
6a488035 | 54 | * |
a6c01b45 | 55 | * @return array |
72b3a70c | 56 | * Array of matching price_fields |
6a488035 TO |
57 | */ |
58 | function civicrm_api3_price_field_get($params) { | |
59 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
60 | } | |
61 | ||
62 | /** | |
2e66abf8 | 63 | * Delete an existing price_field. |
6a488035 | 64 | * |
244bbdd8 | 65 | * This method is used to delete any existing price_field given its id. |
6a488035 | 66 | * |
cf470720 | 67 | * @param array $params |
b081365f | 68 | * Array containing id of the group to be deleted. |
6a488035 | 69 | * |
a6c01b45 | 70 | * @return array |
72b3a70c | 71 | * API result array |
6a488035 TO |
72 | */ |
73 | function civicrm_api3_price_field_delete($params) { | |
74 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
75 | } |