Merge pull request #17522 from seamuslee001/remove_deprecated_methods
[civicrm-core.git] / api / v3 / MailingComponent.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * This api exposes CiviCRM MailingComponent (header and footer).
14 *
15 * @package CiviCRM_APIv3
16 */
17
18 /**
19 * Save a MailingComponent.
20 *
21 * @param array $params
22 *
23 * @throws API_Exception
24 * @return array
25 * API result array.
26 */
27 function civicrm_api3_mailing_component_create($params) {
28 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'MailingComponent');
29 }
30
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;
41 $spec['name']['api.required'] = 1;
42 $spec['component_type']['api.required'] = 1;
43 }
44
45 /**
46 * Get a MailingComponent.
47 *
48 * @param array $params
49 *
50 * @return array
51 * API result array.
52 */
53 function civicrm_api3_mailing_component_get($params) {
54 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
55 }
56
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
67 /**
68 * Delete a MailingComponent.
69 *
70 * @param array $params
71 *
72 * @throws API_Exception
73 * @return array
74 * API result array.
75 */
76 function civicrm_api3_mailing_component_delete($params) {
77 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
78 }