Merge pull request #8092 from eileenmcnaughton/CRM-18368
[civicrm-core.git] / CRM / Utils / Hook.php
index 39eee8a03b858d6b23b4fa7aa64b01f75abddc3a..4b3770b6cd0c5566c37559d4f1c0a9d1ad3627fc 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CiviCRM_Hook
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
  */
 abstract class CRM_Utils_Hook {
 
@@ -489,6 +489,19 @@ abstract class CRM_Utils_Hook {
       ->invoke(5, $type, $contactID, $tableName, $allGroups, $currentGroups, self::$_nullObject, 'civicrm_aclGroup');
   }
 
+  /**
+   * @param string|CRM_Core_DAO $entity
+   * @param array $clauses
+   * @return mixed
+   */
+  public static function selectWhereClause($entity, &$clauses) {
+    $entityName = is_object($entity) ? _civicrm_api_get_entity_name_from_dao($entity) : $entity;
+    return self::singleton()->invoke(2, $entityName, $clauses,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_selectWhereClause'
+    );
+  }
+
   /**
    * This hook is called when building the menu table.
    *
@@ -767,8 +780,9 @@ abstract class CRM_Utils_Hook {
   }
 
   /**
-   * This hook is called when CiviCRM needs to edit/display a custom field with options (select, radio, checkbox,
-   * adv multiselect)
+   * This hook is called when CiviCRM needs to edit/display a custom field with options
+   *
+   * @deprecated in favor of hook_civicrm_fieldOptions
    *
    * @param int $customFieldID
    *   The custom field ID.
@@ -779,8 +793,7 @@ abstract class CRM_Utils_Hook {
    *              to be careful to not overwrite the array.
    *   Only add/edit/remove the specific field options you intend to affect.
    * @param bool $detailedFormat
-   *   If true,.
-   *                the options are in an ID => array ( 'id' => ID, 'label' => label, 'value' => value ) format
+   *   If true, the options are in an ID => array ( 'id' => ID, 'label' => label, 'value' => value ) format
    * @param array $selectAttributes
    *   Contain select attribute(s) if any.
    *
@@ -793,6 +806,23 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * Hook for modifying field options
+   *
+   * @param string $entity
+   * @param string $field
+   * @param array $options
+   * @param array $params
+   *
+   * @return mixed
+   */
+  public static function fieldOptions($entity, $field, &$options, $params) {
+    return self::singleton()->invoke(5, $entity, $field, $options, $params,
+      self::$_nullObject, self::$_nullObject,
+      'civicrm_fieldOptions'
+    );
+  }
+
   /**
    *
    * This hook is called to display the list of actions allowed after doing a search.
@@ -1062,6 +1092,8 @@ abstract class CRM_Utils_Hook {
   /**
    * This hooks allows to change option values.
    *
+   * @deprecated in favor of hook_civicrm_fieldOptions
+   *
    * @param array $options
    *   Associated array of option values / id
    * @param string $name
@@ -1549,6 +1581,22 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * This hook is called when a CiviMail mailing has completed
+   *
+   * @param int $mailingId
+   *   Mailing ID
+   *
+   * @return mixed
+   */
+  public static function postMailing($mailingId) {
+    return self::singleton()->invoke(1, $mailingId,
+      self::$_nullObject, self::$_nullObject,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_postMailing'
+    );
+  }
+
   /**
    * This hook is called when Settings specifications are loaded.
    *
@@ -1776,11 +1824,30 @@ abstract class CRM_Utils_Hook {
    * @return mixed
    * @see Mail::factory
    */
-  public static function alterMail(&$mailer, $driver, $params) {
+  public static function alterMailer(&$mailer, $driver, $params) {
     return self::singleton()
       ->invoke(3, $mailer, $driver, $params, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_alterMailer');
   }
 
+  /**
+   * Deprecated: Misnamed version of alterMailer(). Remove post-4.7.x.
+   * Modify or replace the Mailer object used for outgoing mail.
+   *
+   * @param object $mailer
+   *   The default mailer produced by normal configuration; a PEAR "Mail" class (like those returned by Mail::factory)
+   * @param string $driver
+   *   The type of the default mailer (eg "smtp", "sendmail", "mock", "CRM_Mailing_BAO_Spool")
+   * @param array $params
+   *   The default mailer config options
+   *
+   * @return mixed
+   * @see Mail::factory
+   * @deprecated
+   */
+  public static function alterMail(&$mailer, $driver, $params) {
+    return CRM_Utils_Hook::alterMailer($mailer, $driver, $params);
+  }
+
   /**
    * This hook is called while building the core search query,
    * so hook implementers can provide their own query objects which alters/extends core search.
@@ -2028,4 +2095,15 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * This hook is called for bypass a few civicrm urls from IDS check
+   * @param array $skip list of civicrm url;
+   */
+  public static function idsException(&$skip) {
+    return self::singleton()->invoke(1, $skip, self::$_nullObject,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_idsException'
+    );
+  }
+
 }