From e1cce4e69672e618aad924159de845c4bb594837 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 18 May 2020 20:08:03 +0200 Subject: [PATCH] LSldapObject :: getLabel(): fix method to be really static --- src/includes/class/class.LSldapObject.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/includes/class/class.LSldapObject.php b/src/includes/class/class.LSldapObject.php index 9c2b65fa..0f89ac71 100644 --- a/src/includes/class/class.LSldapObject.php +++ b/src/includes/class/class.LSldapObject.php @@ -1042,17 +1042,21 @@ class LSldapObject extends LSlog_staticLoggerClass { } /** - * Retourne le label de l'objet + * Retreive object type translated label + * + * @param[in] $type string|null The object type (optional, default: called class name) * * @author Benjamin Renard * - * @retval string Le label de l'objet ($this -> config['label']) + * @retval string The translated object type label */ - public function getLabel($type=null) { - if (is_null($type)) { - $type = $this -> type_name; - } - return __(LSconfig::get("LSobjects.$type.label")); + public static function getLabel($type=null) { + if (is_null($type)) + $type = get_called_class(); + self :: log_debug("getLabel($type): LSobjects.$type.label"); + $label = LSconfig::get("LSobjects.$type.label"); + if (!$label) return; + return __($label); }