From 3732dafaa3c2fd5bc40abb490e163c032d0af47d Mon Sep 17 00:00:00 2001 From: Moritz Strohm <strohm@data-quest.de> Date: Mon, 18 Sep 2023 13:38:40 +0000 Subject: [PATCH] ResourcePropertyDefinition::__toString: check if display_name contains more than just blank spaces, fixes #3196 Closes #3196 Merge request studip/studip!2163 --- .../ResourcePropertyDefinition.class.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/lib/models/resources/ResourcePropertyDefinition.class.php b/lib/models/resources/ResourcePropertyDefinition.class.php index 37fa89b95d3..108f7e16b66 100644 --- a/lib/models/resources/ResourcePropertyDefinition.class.php +++ b/lib/models/resources/ResourcePropertyDefinition.class.php @@ -382,23 +382,6 @@ class ResourcePropertyDefinition extends SimpleORMap public function __toString() { - //I18N fields can be an instance of I18NString or not. - //They are I18NString instances if at least two content - //languages are set. - if ($this->display_name instanceof I18NString) { - $name = $this->display_name->__toString(); - if ($name) { - return $name; - } else { - return $this->name; - } - } elseif ($this->display_name) { - //Only one content language is set so that the field - //contains the text string in that language. - return $this->display_name; - } - //No display name defined. We must return the name that - //is used internally. - return $this->name; + return trim($this->display_name) ?: $this->name; } } -- GitLab