1<?php
2
3namespace dokuwiki\plugin\config\core\Setting;
4
5/**
6 * Class setting_string
7 */
8class SettingString extends Setting
9{
10    /** @inheritdoc */
11    public function html(\admin_plugin_config $plugin, $echo = false)
12    {
13        $disable = '';
14
15        if ($this->isProtected()) {
16            $value = $this->protected;
17            $disable = 'disabled="disabled"';
18        } elseif ($echo && $this->error) {
19            $value = $this->input;
20        } else {
21            $value = is_null($this->local) ? $this->default : $this->local;
22        }
23
24        $key = htmlspecialchars($this->key);
25        $value = htmlspecialchars($value);
26
27        $label = '<label for="config___' . $key . '">' . $this->prompt($plugin) . '</label>';
28        $input = '<input id="config___' . $key . '" name="config[' . $key .
29            ']" type="text" class="edit" value="' . $value . '" ' . $disable . '/>';
30        return [$label, $input];
31    }
32}
33