1<?php
2
3namespace dokuwiki\plugin\struct\meta;
4
5use dokuwiki\plugin\struct\types\Decimal;
6
7/**
8 * Published Column
9 */
10class PublishedColumn extends PageColumn
11{
12    /** @noinspection PhpMissingParentConstructorInspection
13     * @param int $sort
14     * @param Decimal $type
15     * @param string $table
16     */
17    public function __construct($sort, Decimal $type, $table)
18    {
19        if ($type->isMulti()) throw new StructException('PublishedColumns can not be multi value types!');
20        Column::__construct($sort, $type, 0, true, $table);
21    }
22
23    /**
24     * @return string
25     */
26    public function getLabel()
27    {
28        return '%published%';
29    }
30
31    /**
32     * @param bool $enforceSingleColumn ignored
33     * @return string
34     */
35    public function getColName($enforceSingleColumn = true)
36    {
37        return 'published';
38    }
39
40    /**
41     * @return string preconfigured label
42     */
43    public function getTranslatedLabel()
44    {
45        /** @var \helper_plugin_struct_config $helper */
46        $helper = plugin_load('helper', 'struct_config');
47        return $helper->getLang('publishedlabel');
48    }
49}
50