<ul class="scrollableDropdownMenu">
{foreach from=$field->getLabelGroup() item=label}
<li data-label-id="{@$label->labelID}">
- <span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span>
+ <span>{@$label->render()}</span>
</li>
{/foreach}
</ul>
<div class="dropdownMenu">
<ul class="scrollableDropdownMenu">
{foreach from=$labelGroup item=label}
- <li data-label-id="{@$label->labelID}"><span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span></li>
+ <li data-label-id="{@$label->labelID}"><span>{@$label->render()}</span></li>
{/foreach}
</ul>
</div>
<span class="icon icon16 fa-tags"></span>
<ul class="labelList">
{foreach from=$article->getLabels() item=label}
- <li><span class="label badge{if $label->getClassNames()} {$label->getClassNames()}{/if}">{$label->getTitle()}</span></li>
+ <li>{@$label->render()}</li>
{/foreach}
</ul>
</li>
<div class="dropdownMenu">
<ul class="scrollableDropdownMenu">
{foreach from=$labelGroup item=label}
- <li data-label-id="{@$label->labelID}"><span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span></li>
+ <li data-label-id="{@$label->labelID}"><span>{@$label->render()}</span></li>
{/foreach}
</ul>
</div>
{if $article->hasLabels()}
<div class="contentItemLabels">
{foreach from=$article->getLabels() item=label}
- <span class="label badge contentItemLabel{if $label->getClassNames()} {$label->getClassNames()}{/if}">{$label->getTitle()}</span>
+ {@$label->render('contentItemLabel')}
{/foreach}
</div>
{/if}
<ul class="scrollableDropdownMenu">
{foreach from=$field->getLabelGroup() item=label}
<li data-label-id="{@$label->labelID}">
- <span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span>
+ <span>{@$label->render()}</span>
</li>
{/foreach}
</ul>
<div class="dropdownMenu">
<ul class="scrollableDropdownMenu">
{foreach from=$labelGroup item=label}
- <li data-label-id="{@$label->labelID}"><span><span class="badge label{if $label->getClassNames()} {@$label->getClassNames()}{/if}">{$label->getTitle()}</span></span></li>
+ <li data-label-id="{@$label->labelID}"><span>{@$label->render()}</span></li>
{/foreach}
</ul>
</div>
{if $article->hasLabels()}
<ul class="labelList" style="float: right; padding-left: 7px;">
{foreach from=$article->getLabels() item=label}
- <li><span class="badge label{if $label->getClassNames()} {$label->getClassNames()}{/if}">{$label->getTitle()}</span></li>
+ <li>{@$label->render()}</li>
{/foreach}
</ul>
{/if}
use wcf\data\DatabaseObject;
use wcf\system\request\IRouteController;
use wcf\system\WCF;
+use wcf\util\StringUtil;
/**
* Represents a label.
return $this->cssClassName;
}
+
+ /**
+ * Returns the HTML representation of the label.
+ *
+ * @param string $additionalClasses
+ * @return string
+ * @since 5.3
+ */
+ public function render($additionalClasses = '') {
+ return '<span class="badge label' . ($this->getClassNames() ? ' ' . $this->getClassNames() : '')
+ . ($additionalClasses ? ' ' . $additionalClasses : '') . '">'
+ . StringUtil::encodeHTML($this->getTitle()) . '</span>';
+ }
}