Merge branch '3.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / data / label / Label.class.php
CommitLineData
3b75466f
MW
1<?php
2namespace wcf\data\label;
3use wcf\data\DatabaseObject;
4use wcf\system\request\IRouteController;
5use wcf\system\WCF;
6
7/**
8 * Represents a label.
9 *
10 * @author Alexander Ebert
c839bd49 11 * @copyright 2001-2018 WoltLab GmbH
3b75466f 12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
e71525e4 13 * @package WoltLabSuite\Core\Data\Label
e9335ed9 14 *
ed6a4e42
MS
15 * @property-read integer $labelID unique id of the label
16 * @property-read integer $groupID id of the label group the label belongs to
17 * @property-read string $label label text or name of language item which contains the label text
18 * @property-read string $cssClassName css class name used when displaying the label
19 * @property-read integer $showOrder position of the label in relation to the other labels in the label group
3b75466f
MW
20 */
21class Label extends DatabaseObject implements IRouteController {
3b75466f
MW
22 /**
23 * Returns the label's textual representation if a label is treated as a
24 * string.
25 *
26 * @return string
27 */
28 public function __toString() {
29 return $this->getTitle();
30 }
31
3b75466f 32 /**
0fcfe5f6 33 * @inheritDoc
3b75466f
MW
34 */
35 public function getTitle() {
36 return WCF::getLanguage()->get($this->label);
37 }
f67e2753
AE
38
39 /**
40 * Returns label CSS class names.
41 *
42 * @return string
43 */
44 public function getClassNames() {
45 if ($this->cssClassName == 'none') {
46 return '';
47 }
48
49 return $this->cssClassName;
50 }
3b75466f 51}