summaryrefslogtreecommitdiff
path: root/inc/Form/HTMLElement.php
blob: 06f27d736943f19b1273cd36561bee771ee45056 (plain)
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
<?php
namespace dokuwiki\Form;

/**
 * Class HTMLElement
 *
 * Holds arbitrary HTML that is added as is to the Form
 *
 * @package dokuwiki\Form
 */
class HTMLElement extends Element {

    /**
     * @var string the raw HTML held by this element
     */
    protected $html = '';

    /**
     * @param string $html
     */
    public function __construct($html) {
        parent::__construct('html');
        $this->val($html);
    }

    /**
     * Get or set the element's content
     *
     * @param null|string $html
     * @return string|$this
     */
    public function val($html = null) {
        if($html !== null) {
            $this->html = $html;
            return $this;
        }
        return $this->html;
    }

    /**
     * The HTML representation of this element
     *
     * @return string
     */
    public function toHTML() {
        return $this->val();
    }
}