xref: /dokuwiki/inc/Form/HTMLElement.php (revision de19515f04567db78bd41d5bff68a88bfb8c2a22)
1<?php
2namespace dokuwiki\Form;
3
4/**
5 * Class HTMLElement
6 *
7 * Holds arbitrary HTML that is added as is to the Form
8 *
9 * @package dokuwiki\Form
10 */
11class HTMLElement extends Element {
12
13    /**
14     * @var string the raw HTML held by this element
15     */
16    protected $html = '';
17
18    /**
19     * @param string $html
20     */
21    public function __construct($html) {
22        parent::__construct('html');
23        $this->val($html);
24    }
25
26    /**
27     * Get or set the element's content
28     *
29     * @param null|string $html
30     * @return string|$this
31     */
32    public function val($html = null) {
33        if($html !== null) {
34            $this->html = $html;
35            return $this;
36        }
37        return $this->html;
38    }
39
40    /**
41     * The HTML representation of this element
42     *
43     * @return string
44     */
45    public function toHTML() {
46        return $this->val();
47    }
48}
49