From: Matthias Schmidt Date: Sun, 24 May 2020 11:50:31 +0000 (+0200) Subject: Ease rendering individual labels X-Git-Tag: 5.3.0_Alpha_1~263 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d158b05a6f336426c161765b0488f26ab6842c01;p=GitHub%2FWoltLab%2FWCF.git Ease rendering individual labels Close #3331 --- diff --git a/com.woltlab.wcf/templates/__labelFormField.tpl b/com.woltlab.wcf/templates/__labelFormField.tpl index 90bde6516f..6ce59f485a 100644 --- a/com.woltlab.wcf/templates/__labelFormField.tpl +++ b/com.woltlab.wcf/templates/__labelFormField.tpl @@ -7,7 +7,7 @@ diff --git a/com.woltlab.wcf/templates/__labelSelection.tpl b/com.woltlab.wcf/templates/__labelSelection.tpl index e8ff3d2c43..81b4884a74 100644 --- a/com.woltlab.wcf/templates/__labelSelection.tpl +++ b/com.woltlab.wcf/templates/__labelSelection.tpl @@ -8,7 +8,7 @@ diff --git a/com.woltlab.wcf/templates/article.tpl b/com.woltlab.wcf/templates/article.tpl index b84c63f62b..0f11677328 100644 --- a/com.woltlab.wcf/templates/article.tpl +++ b/com.woltlab.wcf/templates/article.tpl @@ -12,7 +12,7 @@ diff --git a/com.woltlab.wcf/templates/articleAdd.tpl b/com.woltlab.wcf/templates/articleAdd.tpl index e026cc5c15..b3bdb7cc57 100644 --- a/com.woltlab.wcf/templates/articleAdd.tpl +++ b/com.woltlab.wcf/templates/articleAdd.tpl @@ -139,7 +139,7 @@ diff --git a/com.woltlab.wcf/templates/articleListItems.tpl b/com.woltlab.wcf/templates/articleListItems.tpl index 52ee0194bd..dab3340756 100644 --- a/com.woltlab.wcf/templates/articleListItems.tpl +++ b/com.woltlab.wcf/templates/articleListItems.tpl @@ -22,7 +22,7 @@ {if $article->hasLabels()}
{foreach from=$article->getLabels() item=label} - {$label->getTitle()} + {@$label->render('contentItemLabel')} {/foreach}
{/if} diff --git a/wcfsetup/install/files/acp/templates/__labelFormField.tpl b/wcfsetup/install/files/acp/templates/__labelFormField.tpl index 90bde6516f..6ce59f485a 100644 --- a/wcfsetup/install/files/acp/templates/__labelFormField.tpl +++ b/wcfsetup/install/files/acp/templates/__labelFormField.tpl @@ -7,7 +7,7 @@ diff --git a/wcfsetup/install/files/acp/templates/articleAdd.tpl b/wcfsetup/install/files/acp/templates/articleAdd.tpl index e026cc5c15..b3bdb7cc57 100644 --- a/wcfsetup/install/files/acp/templates/articleAdd.tpl +++ b/wcfsetup/install/files/acp/templates/articleAdd.tpl @@ -139,7 +139,7 @@ diff --git a/wcfsetup/install/files/acp/templates/articleList.tpl b/wcfsetup/install/files/acp/templates/articleList.tpl index d9d4c904c2..aeb7a29d7e 100644 --- a/wcfsetup/install/files/acp/templates/articleList.tpl +++ b/wcfsetup/install/files/acp/templates/articleList.tpl @@ -169,7 +169,7 @@ {if $article->hasLabels()} {/if} diff --git a/wcfsetup/install/files/lib/data/label/Label.class.php b/wcfsetup/install/files/lib/data/label/Label.class.php index 2d63925f87..dbfbe56584 100644 --- a/wcfsetup/install/files/lib/data/label/Label.class.php +++ b/wcfsetup/install/files/lib/data/label/Label.class.php @@ -3,6 +3,7 @@ namespace wcf\data\label; use wcf\data\DatabaseObject; use wcf\system\request\IRouteController; use wcf\system\WCF; +use wcf\util\StringUtil; /** * Represents a label. @@ -48,4 +49,17 @@ class Label extends DatabaseObject implements IRouteController { return $this->cssClassName; } + + /** + * Returns the HTML representation of the label. + * + * @param string $additionalClasses + * @return string + * @since 5.3 + */ + public function render($additionalClasses = '') { + return '' + . StringUtil::encodeHTML($this->getTitle()) . ''; + } }