diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-05-08 16:15:16 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-05-08 16:15:16 +0200 |
commit | 12a4e4d1ed827c59290838d5a11d75ad32aa28f1 (patch) | |
tree | 0fa3fe9326391a24c5eef384b4882580bab3a2e1 /inc/Form/Label.php | |
parent | cffb4528cea1b9e7e03dc724aaa9719dbd6e23c9 (diff) | |
download | rpg-12a4e4d1ed827c59290838d5a11d75ad32aa28f1.tar.gz rpg-12a4e4d1ed827c59290838d5a11d75ad32aa28f1.tar.bz2 |
start of rewriting the form handling
This is jsut a small beginning. Not all elements are there, yet. It's
also completely untested so far.
Diffstat (limited to 'inc/Form/Label.php')
-rw-r--r-- | inc/Form/Label.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/inc/Form/Label.php b/inc/Form/Label.php new file mode 100644 index 000000000..c8a862613 --- /dev/null +++ b/inc/Form/Label.php @@ -0,0 +1,46 @@ +<?php +namespace dokuwiki\Form; + +/** + * Class Label + * @package dokuwiki\Form + */ +class Label extends Element { + /** + * @var string the actual label text + */ + public $label = ''; + + /** + * Creates a new Label + * + * @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; + } + + /** + * The HTML representation of this element + * + * @return string + */ + public function toHTML() { + return '<label ' . buildAttributes($this->attrs()) . '>' . hsc($this->label) . '</label>'; + } +} |