Commit | Line | Data |
---|---|---|
d615ccf5 | 1 | <?php |
d615ccf5 CW |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
a30c801b | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
d615ccf5 | 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 | | |
d615ccf5 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
d615ccf5 CW |
11 | |
12 | /** | |
bd876613 | 13 | * This api exposes CiviCRM MailingComponent (header and footer). |
d615ccf5 CW |
14 | * |
15 | * @package CiviCRM_APIv3 | |
d615ccf5 CW |
16 | */ |
17 | ||
18 | /** | |
244bbdd8 | 19 | * Save a MailingComponent. |
dc64d047 | 20 | * |
c490a46a | 21 | * @param array $params |
d9f93da9 EM |
22 | * |
23 | * @throws API_Exception | |
a6c01b45 | 24 | * @return array |
1747ab99 | 25 | * API result array. |
d615ccf5 CW |
26 | */ |
27 | function civicrm_api3_mailing_component_create($params) { | |
807f8008 | 28 | return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingComponent'); |
d615ccf5 CW |
29 | } |
30 | ||
143fcffa TO |
31 | /** |
32 | * Adjust Metadata for Create action. | |
33 | * | |
34 | * The metadata is used for setting defaults, documentation & validation. | |
35 | * | |
36 | * @param array $spec | |
37 | * Array of parameters determined by getfields. | |
38 | */ | |
39 | function _civicrm_api3_mailing_component_create_spec(&$spec) { | |
40 | $spec['is_active']['api.default'] = 1; | |
df197a56 | 41 | $spec['name']['api.required'] = 1; |
42 | $spec['component_type']['api.required'] = 1; | |
143fcffa TO |
43 | } |
44 | ||
d615ccf5 | 45 | /** |
244bbdd8 | 46 | * Get a MailingComponent. |
d615ccf5 | 47 | * |
c490a46a | 48 | * @param array $params |
d9f93da9 | 49 | * |
a6c01b45 | 50 | * @return array |
1747ab99 | 51 | * API result array. |
d615ccf5 CW |
52 | */ |
53 | function civicrm_api3_mailing_component_get($params) { | |
54 | return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
55 | } | |
56 | ||
bd876613 CW |
57 | /** |
58 | * Adjust metadata for get. | |
59 | * | |
60 | * @param array $params | |
61 | */ | |
62 | function _civicrm_api3_mailing_component_get_spec(&$params) { | |
63 | // fetch active records by default | |
64 | $params['is_active']['api.default'] = 1; | |
65 | } | |
66 | ||
d615ccf5 | 67 | /** |
244bbdd8 | 68 | * Delete a MailingComponent. |
d615ccf5 | 69 | * |
c490a46a | 70 | * @param array $params |
d9f93da9 EM |
71 | * |
72 | * @throws API_Exception | |
a6c01b45 | 73 | * @return array |
1747ab99 | 74 | * API result array. |
d615ccf5 CW |
75 | */ |
76 | function civicrm_api3_mailing_component_delete($params) { | |
77 | return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); | |
78 | } |