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