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:
Redefinition of:
- SForm_Renderer::append()
- Append the current element's value to the tree
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:
API Tags:
Redefinition of:
- SForm_Renderer::fetch()
- We need to retrieve the resulting data
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:
Redefinition of:
- SForm_Renderer::pop()
- Move back down in the stack
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:
Redefinition of:
- SForm_Renderer::push()
- Move up a level in the stack