xref: /plugin/structsection/types/Section.php (revision 6b380169b8d3e302861db4a27bdd55306f1cc68d)
1<?php
2namespace dokuwiki\plugin\structwiki\types;
3
4use dokuwiki\plugin\struct\types\TraitFilterPrefix;
5use dokuwiki\plugin\struct\types\Wiki;
6
7class Section extends Wiki {
8    use TraitFilterPrefix;
9
10    protected $config = array(
11        'prefix' => '',
12        'postfix' => '',
13        'placeholder' => '', // ToDo: Make translatable
14        'visibility' => [
15            'ineditor' => true, // removing the inpage-key to prevent early rendering
16        ]
17    );
18
19    /**
20     * Use a text area for input
21     *
22     * @param string $name
23     * @param string $rawvalue
24     * @param string $htmlID
25     *
26     * @return string
27     */
28    public function valueEditor($name, $rawvalue, $htmlID) {
29        $rawvalue = formText($rawvalue);
30        $params = array(
31            'name' => $name,
32            'class' => 'struct_'.strtolower($this->getClass()),
33            'id' => $htmlID,
34            'placeholder' => $this->config['placeholder'],
35        );
36        $attributes = buildAttributes($params, true);
37
38        return "<textarea $attributes>$rawvalue</textarea>";
39    }
40}
41