From de19515f04567db78bd41d5bff68a88bfb8c2a22 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 May 2015 19:12:21 +0200 Subject: started with the compatibility layer --- inc/Form/Form.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'inc/Form/Form.php') diff --git a/inc/Form/Form.php b/inc/Form/Form.php index dc502e021..19cc05065 100644 --- a/inc/Form/Form.php +++ b/inc/Form/Form.php @@ -92,7 +92,7 @@ class Form extends Element { * @param int $pos * @return InputElement */ - public function addTextInput($name, $label, $pos = -1) { + public function addTextInput($name, $label = '', $pos = -1) { return $this->addElement(new InputElement('text', $name, $label), $pos); } @@ -104,7 +104,7 @@ class Form extends Element { * @param int $pos * @return InputElement */ - public function addPasswordInput($name, $label, $pos = -1) { + public function addPasswordInput($name, $label = '', $pos = -1) { return $this->addElement(new InputElement('password', $name, $label), $pos); } @@ -116,7 +116,7 @@ class Form extends Element { * @param int $pos * @return CheckableElement */ - public function addRadioButton($name, $label, $pos = -1) { + public function addRadioButton($name, $label = '', $pos = -1) { return $this->addElement(new CheckableElement('radio', $name, $label), $pos); } @@ -128,7 +128,7 @@ class Form extends Element { * @param int $pos * @return CheckableElement */ - public function addCheckbox($name, $label, $pos = -1) { + public function addCheckbox($name, $label = '', $pos = -1) { return $this->addElement(new CheckableElement('checkbox', $name, $label), $pos); } @@ -140,16 +140,33 @@ class Form extends Element { * @param int $pos * @return TextareaElement */ - public function addTextarea($name, $label, $pos = -1) { + public function addTextarea($name, $label = '', $pos = -1) { return $this->addElement(new TextareaElement($name, $label), $pos); } + /** + * Add fixed HTML to the form + * + * @param $html + * @param int $pos + * @return Element + */ + public function addHTML($html, $pos = -1) { + return $this->addElement(new HTMLElement($html), $pos); + } + + protected function balanceFieldsets() { + //todo implement! + } + /** * The HTML representation of the whole form * * @return string */ public function toHTML() { + $this->balanceFieldsets(); + $html = '
attrs()) . '>' . DOKU_LF; foreach($this->hidden as $name => $value) { -- cgit v1.2.3