From: Tim Otten Date: Tue, 12 Sep 2023 00:08:22 +0000 (-0700) Subject: CRM_Core_Module - Add optional $label property X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=acb27c44dc88594b432d5f713b0270943cc3f13d;p=civicrm-core.git CRM_Core_Module - Add optional $label property --- 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());