Add postProcess hook to MessageTemplates
authorDev <dev@debian.Debian>
Tue, 20 Oct 2020 06:49:58 +0000 (08:49 +0200)
committerDev <dev@debian.Debian>
Mon, 26 Oct 2020 09:13:33 +0000 (10:13 +0100)
Added comments and removed withespace.

CRM/Admin/Form/MessageTemplates.php

index 47567b4742741093626ed2d3a51fe3ed52da2c4b..bc3f3e5074810e0dcfb96a7e23815d6cfa59e9b2 100644 (file)
@@ -270,6 +270,8 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Core_Form {
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
       CRM_Core_BAO_MessageTemplate::del($this->_id);
+
+      $this->postProcessHook();
     }
     elseif ($this->_action & CRM_Core_Action::VIEW) {
       // currently, the above action is used solely for previewing default workflow templates
@@ -309,6 +311,11 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Core_Form {
       }
 
       $messageTemplate = MessageTemplate::save()->setDefaults($params)->setRecords([['id' => $this->_id]])->execute()->first();
+
+      // set the id on save, so it can be used in a extension using the posProcess hook
+      $this->_id = $messageTemplate['id'];
+      $this->postProcessHook();
+
       CRM_Core_Session::setStatus(ts('The Message Template \'%1\' has been saved.', [1 => $messageTemplate['msg_title']]), ts('Saved'), 'success');
 
       if (isset($this->_submitValues['_qf_MessageTemplates_upload'])) {