Source for file QuickHtml.php
Documentation is available at QuickHtml.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Jason Rust <jrust@rustyparts.com> |
// +----------------------------------------------------------------------+
// $Id: QuickHtml.php,v 1.1 2003/08/25 16:41:02 jrust Exp $
require_once('HTML/QuickForm/Renderer/Default.php');
* A renderer that makes it quick and easy to create customized forms.
* This renderer has three main distinctives: an easy way to create
* custom-looking forms, the ability to separate the creation of form
* elements from their display, and being able to use QuickForm in
* widget-based template systems. See the online docs for more info.
* For a usage example see: docs/renderers/QuickHtml_example.php
* The array of rendered elements
// The default templates aren't used for this renderer
* returns the HTML generated for the form
* @param string $data (optional) Any extra data to put before the end of the form
// Render any elements that haven't been rendered explicitly by elementToHtml()
// Insert the extra data and form elements at the end of the form
$this->_html = str_replace('</form>', $data . "\n</form>", $this->_html);
* Gets the html for an element and marks it as rendered.
* @param string $elementName The element name
* @param string $elementValue (optional) The value of the element. This is only useful
* for elements that have the same name (i.e. radio and checkbox), but
* @return string The html for the QuickForm element
// Find the key for the element
if ($data['name'] == $elementName &&
// See if the value must match as well
$data['value'] == $elementValue)) {
$msg = is_null($elementValue) ? " Element $elementName does not exist." :
" Element $elementName with value of $elementValue does not exist.";
$msg = is_null($elementValue) ? " Element $elementName has already been rendered." :
" Element $elementName with value of $elementValue has already been rendered.";
return PEAR ::raiseError (null , QUICKFORM_ERROR, null , E_USER_WARNING , $msg, 'HTML_QuickForm_Error', true );
} // end func elementToHtml
* Gets the html for an element and adds it to the array by calling
* parent::renderElement()
* @param object An HTML_QuickForm_element object
* @param bool Whether an element is required
* @param string An error message associated with an element
* @return mixed HTML string of element if $immediateRender is set, else we just add the
* html to the global _html string
'name' => $element->getName (),
'value' => $element->getValue (),
} // end func renderElement
* Gets the html for a hidden element and adds it to the array.
* @param object An HTML_QuickForm_hidden object being visited
'name' => $element->getName (),
'value' => $element->getValue (),
'html' => $element->toHtml (),
} // end func renderHidden
* Gets the html for the group element and adds it to the array by calling
* @param object An HTML_QuickForm_group object being visited
'name' => $group->getName (),
'value' => $group->getValue (),
} // end func finishGroup
} // end class HTML_QuickForm_Renderer_QuickHtml
Documentation generated on Mon, 11 Mar 2019 14:16:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|