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