HTML_QuickForm
[ class tree: HTML_QuickForm ] [ index: HTML_QuickForm ] [ all elements ]

Class: HTML_QuickForm_Renderer_Array

Source Location: /HTML_QuickForm-3.2.14/QuickForm/Renderer/Array.php

Class Overview

HTML_QuickForm_Renderer
   |
   --HTML_QuickForm_Renderer_Array

A concrete renderer for HTML_QuickForm, makes an array of form contents


Author(s):

Version:

  • Release: 3.2.14

Methods


Child classes:

HTML_QuickForm_Renderer_ArraySmarty
A static renderer for HTML_QuickForm, makes an array of form content useful for a Smarty template

Inherited Variables

Inherited Methods

Class: HTML_QuickForm_Renderer

HTML_QuickForm_Renderer::HTML_QuickForm_Renderer()
Constructor
HTML_QuickForm_Renderer::finishForm()
Called when visiting a form, after processing all form elements
HTML_QuickForm_Renderer::finishGroup()
Called when visiting a group, after processing all group elements
HTML_QuickForm_Renderer::renderElement()
Called when visiting an element
HTML_QuickForm_Renderer::renderHeader()
Called when visiting a header element
HTML_QuickForm_Renderer::renderHidden()
Called when visiting a hidden element
HTML_QuickForm_Renderer::renderHtml()
Called when visiting a raw HTML/text pseudo-element
HTML_QuickForm_Renderer::startForm()
Called when visiting a form, before processing any form elements
HTML_QuickForm_Renderer::startGroup()
Called when visiting a group, before processing any group elements

Class Details

[line 115]
A concrete renderer for HTML_QuickForm, makes an array of form contents

Based on old HTML_QuickForm::toArray() code.

The form array structure is the following:

 array(
   'frozen'           => 'whether the form is frozen',
   'javascript'       => 'javascript for client-side validation',
   'attributes'       => 'attributes for 
tag', 'requirednote => 'note about the required elements', // if we set the option to collect hidden elements 'hidden' => 'collected html of all hidden elements', // if there were some validation errors: 'errors' => array( '1st element name' => 'Error for the 1st element', ... 'nth element name' => 'Error for the nth element' ), // if there are no headers in the form: 'elements' => array( element_1, ... element_N ) // if there are headers in the form: 'sections' => array( array( 'header' => 'Header text for the first header', 'name' => 'Header name for the first header', 'elements' => array( element_1, ... element_K1 ) ), ... array( 'header' => 'Header text for the Mth header', 'name' => 'Header name for the Mth header', 'elements' => array( element_1, ... element_KM ) ) ) );

where element_i is an array of the form:

 array(
   'name'      => 'element name',
   'value'     => 'element value',
   'type'      => 'type of the element',
   'frozen'    => 'whether element is frozen',
   'label'     => 'label for the element',
   'required'  => 'whether element is required',
   'error'     => 'error associated with the element',
   'style'     => 'some information about element style (e.g. for Smarty)',
   // if element is not a group
   'html'      => 'HTML for the element'
   // if element is a group
   'separator' => 'separator for group elements',
   'elements'  => array(
     element_1,
     ...
     element_N
   )
 );



[ Top ]


Method Detail

HTML_QuickForm_Renderer_Array (Constructor)   [line 171]

HTML_QuickForm_Renderer_Array HTML_QuickForm_Renderer_Array( [bool $collectHidden = false], [bool $staticLabels = false])

Constructor
  • Access: public

Parameters:

bool   $collectHidden     true: collect all hidden elements into string; false: process them as usual form elements
bool   $staticLabels     true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"

[ Top ]

finishGroup   [line 248]

void finishGroup( &$group)


Overrides HTML_QuickForm_Renderer::finishGroup() (Called when visiting a group, after processing all group elements)

Parameters:

   &$group     

[ Top ]

renderElement   [line 219]

void renderElement( &$element, $required, $error)


Overrides HTML_QuickForm_Renderer::renderElement() (Called when visiting an element)

Parameters:

   &$element     
   $required     
   $error     

[ Top ]

renderHeader   [line 209]

void renderHeader( &$header)


Overridden in child classes as:

HTML_QuickForm_Renderer_ArraySmarty::renderHeader()
Called when visiting a header element

Overrides HTML_QuickForm_Renderer::renderHeader() (Called when visiting a header element)

Parameters:

   &$header     

[ Top ]

renderHidden   [line 229]

void renderHidden( &$element)


Overrides HTML_QuickForm_Renderer::renderHidden() (Called when visiting a hidden element)

Parameters:

   &$element     

[ Top ]

setElementStyle   [line 331]

void setElementStyle( mixed $elementName, [string $styleName = null])

Sets a style to use for element rendering
  • Access: public

Parameters:

mixed   $elementName     element name or array ('element name' => 'style name')
string   $styleName     style name if $elementName is not an array

[ Top ]

startForm   [line 191]

void startForm( &$form)


Overrides HTML_QuickForm_Renderer::startForm() (Called when visiting a form, before processing any form elements)

Parameters:

   &$form     

[ Top ]

startGroup   [line 239]

void startGroup( &$group, $required, $error)


Overridden in child classes as:

HTML_QuickForm_Renderer_ArraySmarty::startGroup()
Called when visiting a group, before processing any group elements

Overrides HTML_QuickForm_Renderer::startGroup() (Called when visiting a group, before processing any group elements)

Parameters:

   &$group     
   $required     
   $error     

[ Top ]

toArray   [line 185]

array toArray( )

Returns the resultant array
  • Access: public

[ Top ]


Documentation generated on Thu, 20 Nov 2014 16:00:07 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.