xref: /plugin/struct/types/Text.php (revision c2fd0bf0f1e5f70408ef7f28c9c9bb2ddde010e7)
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
15
16    /**
17     * Output the stored data
18     *
19     * @param int|string $value
20     * @return string the HTML to represent this data
21     */
22    public function getDisplayData($value) {
23        return hsc($this->config['prefix'] . $value . $this->config['postfix']);
24    }
25
26    /**
27     * Return the editor to edit a single value
28     *
29     * @param string $name the form name where this has to be stored
30     * @param string $value the current value
31     * @return string html
32     */
33    public function valueEditor($name, $value) {
34        if(is_array($value)) {$value = join(', ',$value);}
35        $html = '';
36        $html .= "<input name=\"$name\" value=\"$value\" />";
37        return "$html";
38    }
39}
40