CRM-15306: Adding hook to alter mail templates
[civicrm-core.git] / CRM / Utils / Hook.php
index 15bc0bf93bfebc43c65374e2cb7ec803ddbd14f9..af9744cb55a64955840aa23539a61e6cfa992fbb 100644 (file)
@@ -998,6 +998,21 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * This hook is called after getting the content of the mail and before tokenizing it.
+   *
+   * @param array $templates
+   *   Array fields include: html, text, subject
+   *
+   * @return mixed
+   */
+  public static function alterMailTemplates(&$templates) {
+    return self::singleton()->invoke(1, $templates,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_alterMailTemplates'
+    );
+  }
+
   /**
    * This hook is called when rendering the Manage Case screen.
    *
@@ -1880,12 +1895,13 @@ abstract class CRM_Utils_Hook {
    * This hook fires whenever a record in a case changes.
    *
    * @param \Civi\CCase\Analyzer $analyzer
+   *   A bundle of data about the case (such as the case and activity records).
    */
   public static function caseChange(\Civi\CCase\Analyzer $analyzer) {
     $event = new \Civi\CCase\Event\CaseChangeEvent($analyzer);
     \Civi::service('dispatcher')->dispatch("hook_civicrm_caseChange", $event);
 
-    return self::singleton()->invoke(1, $angularModules,
+    self::singleton()->invoke(1, $analyzer,
       self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
       'civicrm_caseChange'
     );