From 08099e4fe1e56308bc42cc639d187863088494bd Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 18 Aug 2015 19:28:45 +0200 Subject: Form: correctly set type attribute for inputs #1312 --- inc/Form/InputElement.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/Form/InputElement.php') diff --git a/inc/Form/InputElement.php b/inc/Form/InputElement.php index 5908f7d11..693eeffc5 100644 --- a/inc/Form/InputElement.php +++ b/inc/Form/InputElement.php @@ -29,6 +29,7 @@ class InputElement extends Element { public function __construct($type, $name, $label = '') { parent::__construct($type, array('name' => $name)); $this->attr('name', $name); + $this->attr('type', $type); if($label) $this->label = new Label($label); } -- cgit v1.2.3 From a453c16b3290eabdf35778c54498101c737544e1 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 18 Aug 2015 20:36:08 +0200 Subject: Form: more flexible label handling #1312 You now can add labels that don't wrap around inputs, but you have to ensure IDs are properly assigned yourself. The Label class has been renamed to LabelElement to reflect the naming scheme of the other elements. --- inc/Form/InputElement.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'inc/Form/InputElement.php') diff --git a/inc/Form/InputElement.php b/inc/Form/InputElement.php index 693eeffc5..694dd0848 100644 --- a/inc/Form/InputElement.php +++ b/inc/Form/InputElement.php @@ -12,7 +12,7 @@ namespace dokuwiki\Form; */ class InputElement extends Element { /** - * @var Label + * @var LabelElement */ protected $label = null; @@ -24,19 +24,19 @@ class InputElement extends Element { /** * @param string $type The type of this element * @param string $name The name of this form element - * @param string $label The label text for this element + * @param string $label The label text for this element (will be autoescaped) */ public function __construct($type, $name, $label = '') { parent::__construct($type, array('name' => $name)); $this->attr('name', $name); $this->attr('type', $type); - if($label) $this->label = new Label($label); + if($label) $this->label = new LabelElement($label); } /** * Returns the label element if there's one set * - * @return Label|null + * @return LabelElement|null */ public function getLabel() { return $this->label; -- cgit v1.2.3