Merge pull request #23368 from eileenmcnaughton/ref
[civicrm-core.git] / ext / civigrant / civigrant.php
index e3df6eb489aac6f9aae824ffacffd9ea625aace7..8e49dbdbdb27a18e9722b88e4dc69eebc4dd9f0f 100644 (file)
@@ -40,14 +40,33 @@ function civigrant_civicrm_entityTypes(&$entityTypes) {
 function civigrant_civicrm_links($context, $name, $id, &$links) {
   if ($context === 'create.new.shortcuts' && CRM_Core_Permission::check(['access CiviGrant', 'edit grants'])) {
     $links[] = [
-      'path' => 'civicrm/grant/add',
-      'query' => "reset=1&action=add&context=standalone",
       'ref' => 'new-grant',
+      'name' => 'Grant',
       'title' => ts('Grant'),
+      'url' => CRM_Utils_System::url('civicrm/grant/add', 'reset=1&action=add&context=standalone'),
     ];
   }
 }
 
+/**
+ * Implements hook_civicrm_summaryActions().
+ *
+ * Add contact summary link to create new grant.
+ */
+function civigrant_civicrm_summaryActions(&$menu, $cid) {
+  $menu['grant'] = [
+    'title' => ts('Add Grant'),
+    'weight' => 26,
+    'ref' => 'new-grant',
+    'key' => 'grant',
+    'tab' => 'afsearchGrants',
+    'href' => CRM_Utils_System::url('civicrm/contact/view/grant',
+      'reset=1&action=add&context=grant'
+    ),
+    'permissions' => ['edit grants'],
+  ];
+}
+
 /**
  * Implements hook_civicrm_permission().
  *