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