From b78bc9e424d74136bb4367f4dc0e5a93b6fc8b6d Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Wed, 11 Aug 2021 15:26:20 +0100 Subject: [PATCH] Replace extension key with label during install/upgrade/disable/uninstall --- CRM/Admin/Form/Extensions.php | 21 ++++++++++++++----- templates/CRM/Admin/Page/ExtensionDetails.tpl | 9 ++++---- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CRM/Admin/Form/Extensions.php b/CRM/Admin/Form/Extensions.php index dc7687671b..7ee7df2f91 100644 --- a/CRM/Admin/Form/Extensions.php +++ b/CRM/Admin/Form/Extensions.php @@ -20,6 +20,16 @@ */ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { + /** + * @var string + */ + private $_key; + + /** + * @var string + */ + private $label; + /** * Form pre-processing. */ @@ -39,6 +49,7 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { if (!CRM_Utils_Type::validate($this->_key, 'ExtensionKey') && !empty($this->_key)) { throw new CRM_Core_Exception('Extension Key does not match expected standard'); } + $this->label = $remoteExtensionRows[$this->_key]['label'] ?? $this->_key; $session = CRM_Core_Session::singleton(); $url = CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1&action=browse'); $session->pushUserContext($url); @@ -86,35 +97,35 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { case CRM_Core_Action::ADD: $buttonName = ts('Install'); $title = ts('Install "%1"?', [ - 1 => $this->_key, + 1 => $this->label, ]); break; case CRM_Core_Action::UPDATE: $buttonName = ts('Download and Install'); $title = ts('Download and Install "%1"?', [ - 1 => $this->_key, + 1 => $this->label, ]); break; case CRM_Core_Action::DELETE: $buttonName = ts('Uninstall'); $title = ts('Uninstall "%1"?', [ - 1 => $this->_key, + 1 => $this->label, ]); break; case CRM_Core_Action::ENABLE: $buttonName = ts('Enable'); $title = ts('Enable "%1"?', [ - 1 => $this->_key, + 1 => $this->label, ]); break; case CRM_Core_Action::DISABLE: $buttonName = ts('Disable'); $title = ts('Disable "%1"?', [ - 1 => $this->_key, + 1 => $this->label, ]); break; } diff --git a/templates/CRM/Admin/Page/ExtensionDetails.tpl b/templates/CRM/Admin/Page/ExtensionDetails.tpl index 8ca42764d1..40bf6e01c5 100644 --- a/templates/CRM/Admin/Page/ExtensionDetails.tpl +++ b/templates/CRM/Admin/Page/ExtensionDetails.tpl @@ -35,9 +35,9 @@ {foreach from=$extension.requires item=ext} {if array_key_exists($ext, $localExtensionRows)} - {$localExtensionRows.$ext.name} (already downloaded - {$ext}) + {$localExtensionRows.$ext.label|escape} (already downloaded) {elseif array_key_exists($ext, $remoteExtensionRows)} - {$remoteExtensionRows.$ext.name} (not downloaded - {$ext}) + {$remoteExtensionRows.$ext.label|escape} (not downloaded) {else} {$ext} {ts}(not available){/ts} {/if} @@ -56,10 +56,9 @@ {ts}Local path{/ts}{$extension.path|escape} + {if !empty($extension.downloadUrl)} {ts}Download location{/ts}{$extension.downloadUrl|escape} - - {ts}Key{/ts}{$extension.key|escape} - + {/if} -- 2.25.1