CRM-15578 - Mailing.create API - Set defaults that match UX
[civicrm-core.git] / api / v3 / MailingEventSubscribe.php
index 57d2661a09669c2a4544d761f3e65a3e40fb7415..ac82084461ed59a313f481c11ffe37decb832d3a 100644 (file)
@@ -1,8 +1,7 @@
 <?php
-
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * APIv3 functions for registering/processing mailing group events.
  *
  * @package CiviCRM_APIv3
- * @subpackage API_MailerGroup
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
  */
 
 /**
- * Subscribe from mailing group
+ * Subscribe from mailing group.
  *
- * @param array $params Associative array of property
- *                       name/value pairs to insert in new 'survey'
+ * @param array $params
+ *   Array per getfields metadata.
  *
  * @throws API_Exception
- * @return array api result array
- * {@getfields mailing_event_subscribe_create}
- * @access public
+ * @return array
+ *   api result array
  */
 function civicrm_api3_mailing_event_subscribe_create($params) {
   $email      = $params['email'];
@@ -55,7 +49,7 @@ function civicrm_api3_mailing_event_subscribe_create($params) {
 
   $group            = new CRM_Contact_DAO_Group();
   $group->is_active = 1;
-  $group->id        = (int)$group_id;
+  $group->id        = (int) $group_id;
   if (!$group->find(TRUE)) {
     throw new API_Exception('Invalid Group id');
   }
@@ -65,7 +59,6 @@ function civicrm_api3_mailing_event_subscribe_create($params) {
   if ($subscribe !== NULL) {
     /* Ask the contact for confirmation */
 
-
     $subscribe->send_confirm_request($email);
 
     $values = array();
@@ -79,10 +72,12 @@ function civicrm_api3_mailing_event_subscribe_create($params) {
 }
 
 /**
- * Adjust Metadata for Create action
+ * Adjust Metadata for Create action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
  *
- * The metadata is used for setting defaults, documentation & validation
- * @param array $params array or parameters determined by getfields
+ * @param array $params
+ *   Array of parameters determined by getfields.
  */
 function _civicrm_api3_mailing_event_subscribe_create_spec(&$params) {
   $params['email']['api.required'] = 1;
@@ -90,4 +85,3 @@ function _civicrm_api3_mailing_event_subscribe_create_spec(&$params) {
   $params['group_id']['api.required'] = 1;
   $params['group_id']['title'] = 'Unsubscribe From Group';
 }
-