From 71d59b8d46404fde2dc4c5ac77a41bcf30f2a93c Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 6 Apr 2022 18:03:14 +1200 Subject: [PATCH] Fix broken civgrant shortcut link --- CRM/Core/Block.php | 9 ++++----- ext/civigrant/civigrant.php | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CRM/Core/Block.php b/CRM/Core/Block.php index cdde5b928e..432be6d66d 100644 --- a/CRM/Core/Block.php +++ b/CRM/Core/Block.php @@ -185,7 +185,7 @@ class CRM_Core_Block { * One of the class constants (ADD, SEARCH, etc.). * @param string $property * The desired property. - * @param string $value + * @param mixed $value * The value of the desired property. */ public static function setProperty($id, $property, $value) { @@ -413,12 +413,11 @@ class CRM_Core_Block { ); foreach ($values as $key => $val) { - if (!empty($val['title'])) { - $values[$key]['name'] = CRM_Utils_Array::value('name', $val, $val['title']); - } + $values[$key]['name'] = $val['name'] ?? $val['title']; + $values[$key] += ['shortCuts' => []]; } - self::setProperty(self::CREATE_NEW, 'templateValues', array('shortCuts' => $values)); + self::setProperty(self::CREATE_NEW, 'templateValues', ['shortCuts' => $values]); } /** diff --git a/ext/civigrant/civigrant.php b/ext/civigrant/civigrant.php index e3df6eb489..1cc1288838 100644 --- a/ext/civigrant/civigrant.php +++ b/ext/civigrant/civigrant.php @@ -40,10 +40,10 @@ 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'), ]; } } -- 2.25.1