xref: /plugin/struct/meta/RowColumn.php (revision 0ceefd5c55d49dcf9a9f59c8e57e60eaeea1c187)
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        if($type->isMulti()) throw new StructException('RowColumns can not be multi value types!');
19        Column::__construct($sort, $type, 0, true, $table);
20    }
21
22    /**
23     * @return string always '%rowid%'
24     */
25    public function getLabel() {
26        return '%rowid%';
27    }
28
29    /**
30     * @param bool $enforceSingleColumn ignored
31     * @return string
32     */
33    public function getColName($enforceSingleColumn = true) {
34        return 'rid';
35    }
36
37    /**
38     * @return string preconfigured label
39     */
40    public function getTranslatedLabel() {
41        /** @var \helper_plugin_struct_config $helper */
42        $helper = plugin_load('helper', 'struct_config');
43        return $helper->getLang('rowlabel');
44    }
45}
46