blob: 7f515bbdb877421de6c4b60d0e2b2e64465c91c7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<?php
namespace dokuwiki\Form;
/**
* Class TextareaElement
* @package dokuwiki\Form
*/
class TextareaElement extends InputElement
{
/**
* @var string the actual text within the area
*/
protected $text;
/**
* @param string $name The name of this form element
* @param string $label The label text for this element
*/
public function __construct($name, $label)
{
parent::__construct('textarea', $name, $label);
$this->attr('dir', 'auto');
}
/**
* Get or set the element's value
*
* This is the preferred way of setting the element's value
*
* @param null|string $value
* @return string|$this
*/
public function val($value = null)
{
if ($value !== null) {
$this->text = cleanText($value);
return $this;
}
return $this->text;
}
/**
* The HTML representation of this element
*
* @return string
*/
protected function mainElementHTML()
{
if ($this->useInput) $this->prefillInput();
return '<textarea ' . buildAttributes($this->attrs()) . '>' .
formText($this->val()) . '</textarea>';
}
}
|