diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2009-11-17 19:05:58 +0100 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2009-11-17 19:05:58 +0100 |
commit | b81b193eda267ff6d03c383b4b134fa7c4007901 (patch) | |
tree | f655d1d053b2cd137a8ec045d34bb90aca924e63 | |
parent | b4033556bb721349b00671fe7fe7db2d474e1e71 (diff) | |
download | rpg-b81b193eda267ff6d03c383b4b134fa7c4007901.tar.gz rpg-b81b193eda267ff6d03c383b4b134fa7c4007901.tar.bz2 |
changed printForm to getForm and added a print wrapper
Ignore-this: 4b30ebdde6d66e4d502b547fe388c9c
darcs-hash:20091117180558-6e07b-4ea4cb7b71e5300433ce35456192258ebbd2e774.gz
-rw-r--r-- | inc/form.php | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/inc/form.php b/inc/form.php index 4e245c93a..a514526b7 100644 --- a/inc/form.php +++ b/inc/form.php @@ -242,34 +242,45 @@ class Doku_Form { } /** - * printForm + * Return the assembled HTML for the form. * - * Output the form. * Each element in the form will be passed to a function named * 'form_$type'. The function should return the HTML to be printed. * * @author Tom N Harris <tnharris@whoopdedo.org> */ - function printForm() { + function getForm() { global $lang; + $form = ''; $this->params['accept-charset'] = $lang['encoding']; - print '<form ' . html_attbuild($this->params) . '><div class="no">' . DOKU_LF; + $form .= '<form ' . html_attbuild($this->params) . '><div class="no">' . DOKU_LF; if (!empty($this->_hidden)) { foreach ($this->_hidden as $name=>$value) - print form_hidden(array('name'=>$name, 'value'=>$value)); + $form .= form_hidden(array('name'=>$name, 'value'=>$value)); } foreach ($this->_content as $element) { if (is_array($element)) { $elem_type = $element['_elem']; if (function_exists('form_'.$elem_type)) { - print call_user_func('form_'.$elem_type, $element).DOKU_LF; + $form .= call_user_func('form_'.$elem_type, $element).DOKU_LF; } } else { - print $element; + $form .= $element; } } - if ($this->_infieldset) print form_closefieldset().DOKU_LF; - print '</div></form>'.DOKU_LF; + if ($this->_infieldset) $form .= form_closefieldset().DOKU_LF; + $form .= '</div></form>'.DOKU_LF; + + return $form; + } + + /** + * Print the assembled form + * + * wraps around getForm() + */ + function printForm(){ + echo $this->getForm(); } } |