xref: /dokuwiki/inc/Form/LabelElement.php (revision 9d01c1d91a93cf50f37d1486481a6493e98be821)
1a453c16bSAndreas Gohr<?php
2*9d01c1d9SSatoshi Sahara
3a453c16bSAndreas Gohrnamespace dokuwiki\Form;
4a453c16bSAndreas Gohr
5a453c16bSAndreas Gohr/**
6a453c16bSAndreas Gohr * Class Label
7a453c16bSAndreas Gohr * @package dokuwiki\Form
8a453c16bSAndreas Gohr */
9*9d01c1d9SSatoshi Saharaclass LabelElement extends ValueElement
10*9d01c1d9SSatoshi Sahara{
11a453c16bSAndreas Gohr    /**
12a453c16bSAndreas Gohr     * Creates a new Label
13a453c16bSAndreas Gohr     *
14a453c16bSAndreas Gohr     * @param string $label This is is raw HTML and will not be escaped
15a453c16bSAndreas Gohr     */
16*9d01c1d9SSatoshi Sahara    public function __construct($label)
17*9d01c1d9SSatoshi Sahara    {
18a453c16bSAndreas Gohr        parent::__construct('label', $label);
19a453c16bSAndreas Gohr    }
20a453c16bSAndreas Gohr
21a453c16bSAndreas Gohr    /**
22a453c16bSAndreas Gohr     * The HTML representation of this element
23a453c16bSAndreas Gohr     *
24a453c16bSAndreas Gohr     * @return string
25a453c16bSAndreas Gohr     */
26*9d01c1d9SSatoshi Sahara    public function toHTML()
27*9d01c1d9SSatoshi Sahara    {
28a453c16bSAndreas Gohr        return '<label ' . buildAttributes($this->attrs()) . '>' . $this->val() . '</label>';
29a453c16bSAndreas Gohr    }
30a453c16bSAndreas Gohr}
31