xref: /plugin/struct/meta/RowColumn.php (revision f107f479f012223bf40b4635e52c57f37c706200)
1*f107f479SAndreas Gohr<?php
2*f107f479SAndreas Gohr
3*f107f479SAndreas Gohrnamespace dokuwiki\plugin\struct\meta;
4*f107f479SAndreas Gohr
5*f107f479SAndreas Gohruse dokuwiki\plugin\struct\types\Decimal;
6*f107f479SAndreas Gohr
7*f107f479SAndreas Gohr/**
8*f107f479SAndreas Gohr * Like a Page Column but for Lookups using a decimal type
9*f107f479SAndreas Gohr */
10*f107f479SAndreas Gohrclass RowColumn extends PageColumn {
11*f107f479SAndreas Gohr
12*f107f479SAndreas Gohr    /** @noinspection PhpMissingParentConstructorInspection
13*f107f479SAndreas Gohr     * @param int $sort
14*f107f479SAndreas Gohr     * @param Decimal $type
15*f107f479SAndreas Gohr     * @param string $table
16*f107f479SAndreas Gohr     */
17*f107f479SAndreas Gohr    public function __construct($sort, Decimal $type, $table) {
18*f107f479SAndreas Gohr        if($type->isMulti()) throw new StructException('RowColumns can not be multi value types!');
19*f107f479SAndreas Gohr        Column::__construct($sort, $type, 0, true, $table);
20*f107f479SAndreas Gohr    }
21*f107f479SAndreas Gohr
22*f107f479SAndreas Gohr    /**
23*f107f479SAndreas Gohr     * @return string always '%rowid%'
24*f107f479SAndreas Gohr     */
25*f107f479SAndreas Gohr    public function getLabel() {
26*f107f479SAndreas Gohr        return '%rowid%';
27*f107f479SAndreas Gohr    }
28*f107f479SAndreas Gohr
29*f107f479SAndreas Gohr    /**
30*f107f479SAndreas Gohr     * @return string preconfigured label
31*f107f479SAndreas Gohr     */
32*f107f479SAndreas Gohr    public function getTranslatedLabel() {
33*f107f479SAndreas Gohr        /** @var \helper_plugin_struct_config $helper */
34*f107f479SAndreas Gohr        $helper = plugin_load('helper', 'struct_config');
35*f107f479SAndreas Gohr        return $helper->getLang('rowlabel');
36*f107f479SAndreas Gohr    }
37*f107f479SAndreas Gohr}
38