phpDocumentor SForm
Renderers
[ class tree: SForm ] [ index: SForm ] [ all elements ]

Class: SForm_Renderer_Array

Source Location: /SForm.php

Class SForm_Renderer_Array

Class Overview

Render the form to an array

This array can be passed to a template engine like Smarty, or dumped for debugging purposes.

Located in /SForm.php [line 3238]

SForm_Renderer
   |
   --SForm_Renderer_Array

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From SForm_Renderer

SForm_Renderer::$currElms
SForm_Renderer::$errors
SForm_Renderer::$hidden
SForm_Renderer::$javascript
SForm_Renderer::$jsPostfix
SForm_Renderer::$jsPrefix
SForm_Renderer::$required
SForm_Renderer::$stack

Inherited From SForm_Renderer

SForm_Renderer::append()
Append the current element's value to the tree
SForm_Renderer::applyJavaScript()
Applies the rendered JavaScript to the given form
SForm_Renderer::fetch()
We need to retrieve the resulting data
SForm_Renderer::pop()
Move back down in the stack
SForm_Renderer::push()
Move up a level in the stack
SForm_Renderer::rendJavaScript()
Render the array of JavaScript into a script
SForm_Renderer::startForm()
Start rendering the form

[ Top ]
Method Summary
void   append()   Append a new element to the output
void   fetch()   Add the JavaScript and hidden elms
void   pop()   Move back down
void   push()   Move up a level in the stack

[ Top ]
Methods
append  [line 3264]

  void append( SForm_Element $elm  )

Append a new element to the output

Aquire all the useful information about an element. Note that this could be a leaf element, or a container node.

First, we get the $id of the element via SForm_Element::getLocalId(). Then we retrieve the element's value via SForm_Element::getValue(). For the type of the element, we use PHP's built in function http://www.php.net/get_class. We retrieve if the element is frozen via SForm_Element::isFrozen(). If the element has throw an error, the error message will be available via SForm_Element::getErrorHtml(). The label wrapped in <label> tags is retrieved via SForm_Element::getLabelHtml(). Then the element's actual tag is retrieved via SForm_Element::toHtml(). If the element has any hidden tags to append to the form, they are returned via SForm_Element::toHidden(), and any JavaScript is rendered via SForm_Element::toJavaScript().

Keys created are: 'id', 'value', 'type', 'error', 'label', 'html'

If there were any errors thrown here, an internal flag is also tripped in $errors so when the form is completed we can add a boolean which shows that there were errors generated.

Parameters:
object Element   $elm:  to append

API Tags:
Access:  public


Redefinition of:
SForm_Renderer::append()
Append the current element's value to the tree

[ Top ]
fetch  [line 3357]

  void fetch( SForm $form  )

Add the JavaScript and hidden elms

After the form is rendered, create the JavaScript, hidden elements, and errors as needed. Note that these are not created when the opening <form> tag is created because we haven't looked at all the elements yet to determine if JavaScript is used.

Parameters:
object The   $form:  form

API Tags:
Access:  public


Redefinition of:
SForm_Renderer::fetch()
We need to retrieve the resulting data

[ Top ]
pop  [line 3332]

  void pop( SForm_Container $node  )

Move back down

This is called when we exit a container. We are creating two levels of nesting for reasons outlined in push().

The entries created here are 'elements' and 'htmlFin'. 'elements' contains the arrays of all of the children of this container, indexed by Local ID. 'htmlFin' is the appropriate HTML to close the tag that was opened when the container was popped.

Parameters:
object Container   $node:  that we are moving out of

API Tags:
Access:  public


Redefinition of:
SForm_Renderer::pop()
Move back down in the stack

[ Top ]
push  [line 3310]

  void push( SForm_Container $node  )

Move up a level in the stack

This function is called when we are moving into a container. Because we are creating an array with elements, element attributes, and sub- elements, we are creating two levels of nestings. The main level has the various rendered attributes of the element that are created in append(). Then each container has two additional attributes: 'elements' and 'htmlFin'. The sub-elements are stored in the 'elements' attribute as an array, indexed by Local ID.

Parameters:
object Container   $node:  that we are moving into

API Tags:
Access:  public
See:  SForm_Renderer_Array::pop()


Redefinition of:
SForm_Renderer::push()
Move up a level in the stack

[ Top ]

Documentation generated on Mon, 09 Apr 2007 19:08:47 -0500 by phpDocumentor 1.3.0