From: Alexander Ebert Date: Wed, 20 Sep 2023 16:54:33 +0000 (+0200) Subject: Include the label id in `Label::render()` X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=28a30e916c4a422cbde7c7f89846588342ba378f;p=GitHub%2FWoltLab%2FWCF.git Include the label id in `Label::render()` --- diff --git a/wcfsetup/install/files/lib/data/label/Label.class.php b/wcfsetup/install/files/lib/data/label/Label.class.php index ebb5f89a08..5821711d33 100644 --- a/wcfsetup/install/files/lib/data/label/Label.class.php +++ b/wcfsetup/install/files/lib/data/label/Label.class.php @@ -60,10 +60,20 @@ class Label extends DatabaseObject implements IRouteController * @return string * @since 5.3 */ - public function render($additionalClasses = '') + public function render($additionalClasses = ''): string { - return '' - . StringUtil::encodeHTML($this->getTitle()) . ''; + $classNames = 'badge label'; + if ($this->getClassNames()) { + $classNames .= " {$this->getClassNames()}"; + } + if ($additionalClasses) { + $classNames .= " {$additionalClasses}"; + } + return \sprintf( + '%s', + $classNames, + $this->labelID, + StringUtil::encodeHTML($this->getTitle()), + ); } }