Emit deprecated warning for typo version of hook_civicrm_links
authorColeman Watts <coleman@civicrm.org>
Wed, 6 Apr 2022 13:49:57 +0000 (09:49 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 6 Apr 2022 13:49:57 +0000 (09:49 -0400)
The context string 'create.new.shorcuts' was deprecated in 2018.
This adds a noisy warning to ensure extension devs update their code.

CRM/Core/Block.php

index cdde5b928e8d9df213b773f105216e9fc77d301a..845c9b59fce44066881386245f76046116d9d5b8 100644 (file)
@@ -394,9 +394,6 @@ class CRM_Core_Block {
     }
 
     $values = [];
-    foreach ($shortCuts as $key => $short) {
-      $values[$key] = self::setShortCutValues($short);
-    }
 
     // Deprecated hook with typo.  Please don't use this!
     CRM_Utils_Hook::links('create.new.shorcuts',
@@ -404,6 +401,13 @@ class CRM_Core_Block {
       CRM_Core_DAO::$_nullObject,
       $values
     );
+    if ($values) {
+      CRM_Core_Error::deprecatedWarning('hook_civicrm_links "create.new.shorcuts" deprecated in favor of "create.new.shortcuts"');
+    }
+
+    foreach ($shortCuts as $key => $short) {
+      $values[$key] = self::setShortCutValues($short);
+    }
 
     // Hook that enables extensions to add user-defined links
     CRM_Utils_Hook::links('create.new.shortcuts',