Merge pull request #4112 from dokuwiki/bot/autofix
[dokuwiki.git] / inc / Form / ValueElement.php
blobfab0b40913401952da3671455e52b9adbc43d435
1 <?php
3 namespace dokuwiki\Form;
5 /**
6 * Class ValueElement
8 * Just like an Element but it's value is not part of its attributes
10 * What the value is (tag name, content, etc) is defined by the actual implementations
12 * @package dokuwiki\Form
14 abstract class ValueElement extends Element
16 /**
17 * @var string holds the element's value
19 protected $value = '';
21 /**
22 * @param string $type
23 * @param string $value
24 * @param array $attributes
26 public function __construct($type, $value, $attributes = [])
28 parent::__construct($type, $attributes);
29 $this->val($value);
32 /**
33 * Get or set the element's value
35 * @param null|string $value
36 * @return string|$this
38 public function val($value = null)
40 if ($value !== null) {
41 $this->value = $value;
42 return $this;
44 return $this->value;