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    /** @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('RowColumns can not be multi value types!');
20        Column::__construct($sort, $type, 0, true, $table);
21    }
22
23    /**
24     * @return string always '%rowid%'
25     */
26    public function getLabel()
27    {
28        return '%rowid%';
29    }
30
31    /**
32     * @param bool $enforceSingleColumn ignored
33     * @return string
34     */
35    public function getColName($enforceSingleColumn = true)
36    {
37        return 'rid';
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('rowlabel');
48    }
49}
50