cvs: pear /HTML_QuickForm QuickForm.php

From: Date: Sat, 20 Jul 2002 05:08:13 +0000
Subject: cvs: pear /HTML_QuickForm QuickForm.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5206@lists.php.net to get a copy of this message
jrust Sat Jul 20 01:08:13 2002 EDT Modified files: /pear/HTML_QuickForm QuickForm.php Log: Added optional $in_data parameter to method toHtml so that data can be added to the form right before it is rendered. Useful when using with a template system. Index: pear/HTML_QuickForm/QuickForm.php diff -u pear/HTML_QuickForm/QuickForm.php:1.32 pear/HTML_QuickForm/QuickForm.php:1.33 --- pear/HTML_QuickForm/QuickForm.php:1.32 Fri Jul 19 17:54:22 2002 +++ pear/HTML_QuickForm/QuickForm.php Sat Jul 20 01:08:12 2002 @@ -17,7 +17,7 @@ // | Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: QuickForm.php,v 1.32 2002/07/19 21:54:22 jrust Exp $ +// $Id: QuickForm.php,v 1.33 2002/07/20 05:08:12 jrust Exp $ require_once("PEAR.php"); require_once("HTML/Common.php"); @@ -1723,18 +1723,25 @@ /** * Returns an HTML version of the form * + * @param string $in_data (optional) Any extra data to insert right + * before form is rendered. Useful when using templates. + * * @return string Html version of the form * @since 1.0 * @access public */ - function toHtml () + function toHtml ($in_data = null) { - $html = ""; + if (!is_null($in_data)) { + $this->addData($in_data); + } + + $html = ''; reset($this->_elements); foreach ($this->_elements as $element) { - if (isset($element["header"])) { + if (isset($element['header'])) { $html .= $this->_buildHeader($element); - } elseif (isset($element["data"])) { + } elseif (isset($element['data'])) { $html .= $element['data']; } else { $html .= $this->_buildElement($element);

« previous php.pear.cvs (#5206) next »