From acb27c44dc88594b432d5f713b0270943cc3f13d Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 11 Sep 2023 17:08:22 -0700 Subject: [PATCH] CRM_Core_Module - Add optional $label property --- CRM/Core/Module.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Module.php b/CRM/Core/Module.php index 7f0daefb2a..1e46e957de 100644 --- a/CRM/Core/Module.php +++ b/CRM/Core/Module.php @@ -24,6 +24,13 @@ class CRM_Core_Module { */ public $name; + /** + * Pretty name of the module + * + * @var string + */ + public $label; + /** * Is the module enabled. * @@ -35,11 +42,15 @@ class CRM_Core_Module { * Class constructor. * * @param string $name + * Unique machine name of the module * @param bool $is_active + * @param string|null $label + * Pretty name of the module. If omitted, fallback to $name. */ - public function __construct($name, $is_active) { + public function __construct($name, $is_active, ?string $label = NULL) { $this->name = $name; $this->is_active = $is_active; + $this->label = $label ?: $name; } /** @@ -55,7 +66,7 @@ class CRM_Core_Module { if ($fresh || !is_array($result)) { $result = CRM_Extension_System::singleton()->getMapper()->getModules(); // pseudo-module for core - $result[] = new CRM_Core_Module('civicrm', TRUE); + $result[] = new CRM_Core_Module('civicrm', TRUE, ts('CiviCRM Core')); $config = CRM_Core_Config::singleton(); $result = array_merge($result, $config->userSystem->getModules()); -- 2.25.1