(dev/core#1104) make admin panels hookable
authoryashodha <yashodha@cividesk.com>
Thu, 4 Jul 2019 10:36:07 +0000 (16:06 +0530)
committeryashodha <yashodha@cividesk.com>
Thu, 4 Jul 2019 10:36:07 +0000 (16:06 +0530)
CRM/Admin/Page/Admin.php
CRM/Utils/Hook.php

index f195b5d693e0a18365e31851e17b4e7254569591..1c0fdc56ae421665c7b3f38d27033680fdf1d6ad 100644 (file)
@@ -105,6 +105,8 @@ class CRM_Admin_Page_Admin extends CRM_Core_Page {
         $adminPanel[$groupId]['title'] = $title;
       }
     }
+
+    CRM_Utils_Hook::alterAdminPanel($adminPanel);
     $this->assign('adminPanel', $adminPanel);
     $this->_showHide->addToTemplate();
     return parent::run();
index 2595679938fcdc3a6a06ca56d7168363c22feb2d..6b70eadf012ea1636ca10407621d9b3eac810e43 100644 (file)
@@ -835,6 +835,21 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * This hook allows modification of the admin panels
+   *
+   * @param array $panels
+   *   Associated array of admin panels
+   *
+   * @return mixed
+   */
+  public static function alterAdminPanel(&$panels) {
+    return self::singleton()->invoke(array('panels'), $panels,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_alterAdminPanel'
+    );
+  }
+
   /**
    * This hook is called when sending an email / printing labels to get the values for all the
    * tokens returned by the 'tokens' hook