X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FMessageTemplate.php;h=809db8fcbe79e444557ce3131e83f4b1159ff367;hb=85bb0909cffd925f4cd5c0022a68a1ff74d3ad8e;hp=80fc3abe197454073dcf143cc9ed6a3efdb43c35;hpb=ce4fd42f89389d27c1ddd061b5ad2e92809ebe9a;p=civicrm-core.git diff --git a/api/v3/MessageTemplate.php b/api/v3/MessageTemplate.php index 80fc3abe19..809db8fcbe 100644 --- a/api/v3/MessageTemplate.php +++ b/api/v3/MessageTemplate.php @@ -32,7 +32,6 @@ * */ - /** * @access public */ @@ -66,9 +65,12 @@ function civicrm_api3_message_template_delete($params) { return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); } - +/** + * @param $params + */ function _civicrm_api3_message_template_get_spec(&$params) { } + /** * Retrieve one or more message_template * @@ -87,3 +89,29 @@ function civicrm_api3_message_template_get($params) { return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); } +/** + * Sends a template. + */ +function civicrm_api3_message_template_send($params) { + CRM_Core_BAO_MessageTemplates::sendTemplate($params); +} + +/** + * Adjust Metadata for Create action + * + * The metadata is used for setting defaults, documentation & + * validation. + * + * @param array $params array or parameters determined by getfields + */ +function _civicrm_api3_message_template_send_spec(&$params) { + $required = array( + 'messageTemplateID', + 'contactId', + 'toEmail', + 'toName', + ); + foreach ($required as $value) { + $params[$value]['api.required'] = 1; + } +}