xref: /plugin/struct/meta/RowColumn.php (revision e2c90eebd879dde19ad396148dba094c80ce7cab)
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     * @return string preconfigured label
31     */
32    public function getTranslatedLabel() {
33        /** @var \helper_plugin_struct_config $helper */
34        $helper = plugin_load('helper', 'struct_config');
35        return $helper->getLang('rowlabel');
36    }
37}
38