xref: /plugin/struct/types/Text.php (revision 49d385736e9d9750c47001456827fe8af155ff49)
1<?php
2namespace plugin\struct\types;
3
4class Text extends AbstractBaseType {
5
6    protected $config = array(
7        'prefix' => '',
8        'postfix' => '',
9    );
10
11    /**
12     * Output the stored data
13     *
14     * @param string|int $value the value stored in the database
15     * @param \Doku_Renderer $R the renderer currently used to render the data
16     * @param string $mode The mode the output is rendered in (eg. XHTML)
17     * @return bool true if $mode could be satisfied
18     */
19    public function renderValue($value, \Doku_Renderer $R, $mode) {
20        $R->cdata($this->config['prefix'] . $value . $this->config['postfix']);
21        return true;
22    }
23
24    /**
25     * @param string $name
26     * @param \string[] $values
27     * @return string
28     */
29    public function multiValueEditor($name, $values) {
30        $value = join(', ', $values);
31        return $this->valueEditor($name, $value);
32    }
33
34}
35