summaryrefslogtreecommitdiff
path: root/inc/Form/Label.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/Form/Label.php')
-rw-r--r--inc/Form/Label.php25
1 files changed, 3 insertions, 22 deletions
diff --git a/inc/Form/Label.php b/inc/Form/Label.php
index c8a862613..8dcd7cd5f 100644
--- a/inc/Form/Label.php
+++ b/inc/Form/Label.php
@@ -5,11 +5,7 @@ namespace dokuwiki\Form;
* Class Label
* @package dokuwiki\Form
*/
-class Label extends Element {
- /**
- * @var string the actual label text
- */
- public $label = '';
+class Label extends ValueElement {
/**
* Creates a new Label
@@ -17,22 +13,7 @@ class Label extends Element {
* @param string $label
*/
public function __construct($label) {
- parent::__construct('label');
- $this->label = $label;
- }
-
- /**
- * Get or set the element's label text
- *
- * @param null|string $value
- * @return string|$this
- */
- public function val($value = null) {
- if($value !== null) {
- $this->label = $value;
- return $this;
- }
- return $this->label;
+ parent::__construct('label', $label);
}
/**
@@ -41,6 +22,6 @@ class Label extends Element {
* @return string
*/
public function toHTML() {
- return '<label ' . buildAttributes($this->attrs()) . '>' . hsc($this->label) . '</label>';
+ return '<label ' . buildAttributes($this->attrs()) . '>' . hsc($this->val()) . '</label>';
}
}