xref: /plugin/structsection/types/Section.php (revision 6a5d40b1bde36bd9bd330ee7361c92af8079e66a)
16b380169SMichael Große<?php
2*6a5d40b1SMichael Große
3284f9fc3SMichael Großenamespace dokuwiki\plugin\structsection\types;
46b380169SMichael Große
56b380169SMichael Großeuse dokuwiki\plugin\struct\types\TraitFilterPrefix;
66b380169SMichael Großeuse dokuwiki\plugin\struct\types\Wiki;
76b380169SMichael Große
8*6a5d40b1SMichael Großeclass Section extends Wiki
9*6a5d40b1SMichael Große{
106b380169SMichael Große    use TraitFilterPrefix;
116b380169SMichael Große
126b380169SMichael Große    protected $config = array(
136b380169SMichael Große        'prefix' => '',
146b380169SMichael Große        'postfix' => '',
156b380169SMichael Große        'placeholder' => '', // ToDo: Make translatable
166b380169SMichael Große        'visibility' => [
176b380169SMichael Große            'ineditor' => true, // removing the inpage-key to prevent early rendering
186b380169SMichael Große        ]
196b380169SMichael Große    );
206b380169SMichael Große
216b380169SMichael Große    /**
226b380169SMichael Große     * Use a text area for input
236b380169SMichael Große     *
246b380169SMichael Große     * @param string $name
256b380169SMichael Große     * @param string $rawvalue
266b380169SMichael Große     * @param string $htmlID
276b380169SMichael Große     *
286b380169SMichael Große     * @return string
296b380169SMichael Große     */
30*6a5d40b1SMichael Große    public function valueEditor($name, $rawvalue, $htmlID)
31*6a5d40b1SMichael Große    {
326b380169SMichael Große        $rawvalue = formText($rawvalue);
336b380169SMichael Große        $params = array(
346b380169SMichael Große            'name' => $name,
356b380169SMichael Große            'class' => 'struct_' . strtolower($this->getClass()),
366b380169SMichael Große            'id' => $htmlID,
376b380169SMichael Große            'placeholder' => $this->config['placeholder'],
386b380169SMichael Große        );
396b380169SMichael Große        $attributes = buildAttributes($params, true);
406b380169SMichael Große
416b380169SMichael Große        return "<textarea $attributes>$rawvalue</textarea>";
426b380169SMichael Große    }
436b380169SMichael Große}
44