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 MailingComponent (header and footer).
15 * @package CiviCRM_APIv3
19 * Save a MailingComponent.
21 * @param array $params
23 * @throws API_Exception
27 function civicrm_api3_mailing_component_create($params) {
28 return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__
), $params, 'MailingComponent');
32 * Adjust Metadata for Create action.
34 * The metadata is used for setting defaults, documentation & validation.
37 * Array of parameters determined by getfields.
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;
46 * Get a MailingComponent.
48 * @param array $params
53 function civicrm_api3_mailing_component_get($params) {
54 return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__
), $params);
58 * Adjust metadata for get.
60 * @param array $params
62 function _civicrm_api3_mailing_component_get_spec(&$params) {
63 // fetch active records by default
64 $params['is_active']['api.default'] = 1;
68 * Delete a MailingComponent.
70 * @param array $params
72 * @throws API_Exception
76 function civicrm_api3_mailing_component_delete($params) {
77 return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__
), $params);