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

Class: HTML_QuickForm2_Renderer_Callback

Source Location: /HTML_QuickForm2-2.0.0/HTML/QuickForm2/Renderer/Callback.php

Class Overview

HTML_QuickForm2_Renderer
   |
   --HTML_QuickForm2_Renderer_Callback

Callback renderer for QuickForm2


Author(s):

Version:

  • Release: 2.0.0

Variables

Methods


Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Renderer

HTML_QuickForm2_Renderer::__construct()
Constructor
HTML_QuickForm2_Renderer::exportMethods()
Returns an array of "published" method names that should be callable through proxy
HTML_QuickForm2_Renderer::factory()
Creates a new renderer instance of the given type
HTML_QuickForm2_Renderer::finishContainer()
Finishes rendering a generic container, called after processing contained elements
HTML_QuickForm2_Renderer::finishForm()
Finishes rendering a form, called after processing contained elements
HTML_QuickForm2_Renderer::finishGroup()
Finishes rendering a group, called after processing grouped elements
HTML_QuickForm2_Renderer::getJavascriptBuilder()
Returns the javascript builder object
HTML_QuickForm2_Renderer::getOption()
Returns the value(s) of the renderer option(s)
HTML_QuickForm2_Renderer::methodExists()
Checks whether a method is available in this object
HTML_QuickForm2_Renderer::register()
Registers a new renderer type
HTML_QuickForm2_Renderer::registerPlugin()
Registers a plugin for a renderer type
HTML_QuickForm2_Renderer::renderElement()
Renders a generic element
HTML_QuickForm2_Renderer::renderHidden()
Renders a hidden element
HTML_QuickForm2_Renderer::reset()
Resets the accumulated data
HTML_QuickForm2_Renderer::setJavascriptBuilder()
Sets the javascript builder object
HTML_QuickForm2_Renderer::setOption()
Sets the option(s) affecting renderer behaviour
HTML_QuickForm2_Renderer::startContainer()
Starts rendering a generic container, called before processing contained elements
HTML_QuickForm2_Renderer::startForm()
Starts rendering a form, called before processing contained elements
HTML_QuickForm2_Renderer::startGroup()
Starts rendering a group, called before processing grouped elements

Class Details

[line 89]
Callback renderer for QuickForm2

This renderer uses PHP callbacks to render form elements

While almost everything in this class is defined as public, its properties and those methods that are not published (i.e. not in array returned by exportMethods()) will be available to renderer plugins only.

The following methods are published:

Using a callback to render a Submit button and a Cancel link:
  1.  function renderSubmitCancel($renderer$submit{
  2.    $data $submit->getData();
  3.    $url !empty($data['cancel']$data['cancel''/';
  4.    return '<div>'.$submit.' or <a href="'.$url.'">Cancel</a></div>';
  5.  }
  6.  $renderer HTML_QuickForm2_Renderer::factory('callback');
  7.  $renderer->setCallbackForId($submit->getId()'renderSubmitCancel');



[ Top ]


Class Variables

$callbacksForClass = array(
        'html_quickform2'                     => array('HTML_QuickForm2_Renderer_Callback', '_renderForm'),'html_quickform2_element'=>array('HTML_QuickForm2_Renderer_Callback','_renderElement'),'html_quickform2_element_inputhidden'=>array('HTML_QuickForm2_Renderer_Callback','_renderHidden'),'html_quickform2_container'=>array('HTML_QuickForm2_Renderer_Callback','_renderContainer'),'html_quickform2_container_group'=>array('HTML_QuickForm2_Renderer_Callback','_renderGroup'),'html_quickform2_container_fieldset'=>array('HTML_QuickForm2_Renderer_Callback','_renderFieldset'),'html_quickform2_container_repeat'=>array('HTML_QuickForm2_Renderer_Callback','_renderRepeat'))

[line 155]

Array of callbacks defined using an element class
  • Access: public

Type:   array


[ Top ]

$callbacksForId = array()

[line 149]

Array of callbacks defined using an element or container ID
  • Access: public

Type:   array


[ Top ]

$elementCallbacksForGroupClass = array(
        'html_quickform2_container' => array(
            'html_quickform2_element' => array('HTML_QuickForm2_Renderer_Callback', '_renderGroupedElement')))

[line 175]

Array of callbacks defined using a group class
  • Access: public

Type:   array


[ Top ]

$elementCallbacksForGroupId = array()

[line 169]

Array of callbacks defined using a group ID
  • Access: public

Type:   array


[ Top ]

$errorGroupCallback = array('HTML_QuickForm2_Renderer_Callback', '_renderErrorsGroup')

[line 125]

Callback used to render errors if 'group_errors' is on
  • Access: public

Type:   mixed


[ Top ]

$errors = array()

[line 119]

Array of validation errors if 'group_errors' option is on
  • Access: public

Type:   array


[ Top ]

$groupId = array()

[line 185]

Array containing IDs of the groups being rendered
  • Access: public

Type:   array


[ Top ]

$hasRequired =  false

[line 95]

Whether the form contains required elements
  • Access: public

Type:   bool


[ Top ]

$hidden = array()

[line 113]

HTML for hidden elements if 'group_hiddens' option is on
  • Access: public

Type:   string


[ Top ]

$hiddenGroupCallback = array('HTML_QuickForm2_Renderer_Callback', '_renderHiddenGroup')

[line 131]

Callback used to render hidden elements
  • Access: public

Type:   mixed


[ Top ]

$hiddenHtml =  ''

[line 107]

HTML for hidden elements if 'group_hiddens' option is on
  • Access: public

Type:   string


[ Top ]

$html = array(array())

[line 101]

HTML generated for the form
  • Access: public

Type:   array


[ Top ]

$labelCallback = array('HTML_QuickForm2_Renderer_Callback', '_renderLabel')

[line 143]

Callback used to render labels
  • Access: public

Type:   mixed


[ Top ]

$requiredNoteCallback = array('HTML_QuickForm2_Renderer_Callback', '_renderRequiredNote')

[line 137]

Callback used to render required note
  • Access: public

Type:   mixed


[ Top ]



Method Detail

exportMethods   [line 187]

void exportMethods( )

  • Access: protected

Overrides HTML_QuickForm2_Renderer::exportMethods() (Returns an array of "published" method names that should be callable through proxy)
[ Top ]

findCallback   [line 734]

callback|null findCallback( HTML_QuickForm2_Node $element, [callback|null $default = null])

Finds a proper callback for the element

Callbacks are scanned in a predefined order. First, if a callback was set for a specific element by id, it is returned, no matter if the element belongs to a group. If the element does not belong to a group, we try to match a callback using the element class. But, if the element belongs to a group, callbacks are first looked up using the containing group id, then using the containing group class. When no callback is found, the provided default callback is returned.

  • Access: public

Parameters:

HTML_QuickForm2_Node   $element     Element being rendered
callback|null   $default     Default callback to use if not found

[ Top ]

finishContainer   [line 474]

void finishContainer( HTML_QuickForm2_Node $container)

Finishes rendering a generic container, called after processing contained elements
  • Access: public

Overrides HTML_QuickForm2_Renderer::finishContainer() (Finishes rendering a generic container, called after processing contained elements)

Parameters:

HTML_QuickForm2_Node   $container     Container being rendered

[ Top ]

finishForm   [line 523]

void finishForm( HTML_QuickForm2_Node $form)

Finishes rendering a form, called after processing contained elements
  • Access: public

Overrides HTML_QuickForm2_Renderer::finishForm() (Finishes rendering a form, called after processing contained elements)

Parameters:

HTML_QuickForm2_Node   $form     Form being rendered

[ Top ]

finishGroup   [line 499]

void finishGroup( HTML_QuickForm2_Node $group)

Finishes rendering a group, called after processing grouped elements
  • Access: public

Overrides HTML_QuickForm2_Renderer::finishGroup() (Finishes rendering a group, called after processing grouped elements)

Parameters:

HTML_QuickForm2_Node   $group     Group being rendered

[ Top ]

renderElement   [line 420]

void renderElement( HTML_QuickForm2_Node $element)

Renders a generic element
  • Access: public

Overrides HTML_QuickForm2_Renderer::renderElement() (Renders a generic element)

Parameters:

HTML_QuickForm2_Node   $element     Element being rendered

[ Top ]

renderHidden   [line 445]

void renderHidden( HTML_QuickForm2_Node $element)

Renders a hidden element
  • Access: public

Overrides HTML_QuickForm2_Renderer::renderHidden() (Renders a hidden element)

Parameters:

HTML_QuickForm2_Node   $element     Hidden element being rendered

[ Top ]

renderLabel   [line 435]

string renderLabel( HTML_QuickForm2_Node $element)

Renders an element label
  • Access: public

Parameters:

HTML_QuickForm2_Node   $element     Element being rendered

[ Top ]

reset   [line 696]

HTML_QuickForm2_Renderer_Callback reset( )

Resets the accumulated data

This method is called automatically by startForm() method, but should be called manually before calling other rendering methods separately.

  • Access: public

Overrides HTML_QuickForm2_Renderer::reset() (Resets the accumulated data)
[ Top ]

setCallbackForClass   [line 599]

HTML_QuickForm2_Renderer_Callback setCallbackForClass( string $className, callback|null $callback)

Sets callback for form elements that are instances of the given class

When searching for a callback to use, renderer will check for callbacks set for element's class and its parent classes, until found. Thus a more specific callbacks will override a more generic one.

  • Access: public

Parameters:

string   $className     Class name
callback|null   $callback     Callback to use for elements of that class

[ Top ]

setCallbackForId   [line 619]

HTML_QuickForm2_Renderer_Callback setCallbackForId( string $id, callback|null $callback)

Sets callback for form element with the given id

If a callback is set for an element via this method, it will be used. In the other case a generic callback set by setCallbackForClass() or setElementCallbackForGroupClass() will be used.

  • Access: public

Parameters:

string   $id     Element's id
callback|null   $callback     Callback to use for rendering of that element

[ Top ]

setElementCallbackForGroupClass   [line 658]

HTML_QuickForm2_Renderer_Callback setElementCallbackForGroupClass( string $groupClass, string $elementClass, callback|null $callback)

Sets grouped elements callbacks using group class

Callbacks set via setCallbackForClass() will not be used for grouped form elements. When searching for a callback to use, the renderer will first consider callback set for a specific group id, then the group callback set by group class.

  • Access: public

Parameters:

string   $groupClass     Group class name
string   $elementClass     Element class name
callback|null   $callback     Callback

[ Top ]

setElementCallbackForGroupId   [line 680]

HTML_QuickForm2_Renderer_Callback setElementCallbackForGroupId( string $groupId, string $elementClass, callback|null $callback)

Sets grouped elements callback using group id

Callbacks set via setCallbackForClass() will not be used for grouped form elements. When searching for a callback to use, the renderer will first consider callback set for a specific group id, then the group callbacks set by group class.

  • Access: public

Parameters:

string   $groupId     Group id
string   $elementClass     Element class name
callback|null   $callback     Callback

[ Top ]

setErrorGroupCallback   [line 636]

HTML_QuickForm2_Renderer_Callback setErrorGroupCallback( callback|null $callback)

Sets callback for rendering validation errors

This callback will be used if 'group_errors' option is set to true.

  • Access: public

Parameters:

callback|null   $callback     Callback for validation errors

[ Top ]

setHiddenGroupCallback   [line 564]

HTML_QuickForm2_Renderer_Callback setHiddenGroupCallback( callback|null $callback)

Sets callback for rendering hidden elements if option group_hiddens is true
  • Access: public

Parameters:

callback|null   $callback     PHP callback

[ Top ]

setLabelCallback   [line 549]

HTML_QuickForm2_Renderer_Callback setLabelCallback( callback|null $callback)

Sets callback for rendering labels
  • Access: public

Parameters:

callback|null   $callback     PHP callback

[ Top ]

setRequiredNoteCallback   [line 579]

HTML_QuickForm2_Renderer_Callback setRequiredNoteCallback( callback|null $callback)

Sets callback for rendering required note
  • Access: public

Parameters:

callback|null   $callback     PHP callback

[ Top ]

startContainer   [line 463]

void startContainer( HTML_QuickForm2_Node $container)

Starts rendering a generic container, called before processing contained elements
  • Access: public

Overrides HTML_QuickForm2_Renderer::startContainer() (Starts rendering a generic container, called before processing contained elements)

Parameters:

HTML_QuickForm2_Node   $container     Container being rendered

[ Top ]

startForm   [line 513]

void startForm( HTML_QuickForm2_Node $form)

Starts rendering a form, called before processing contained elements
  • Access: public

Overrides HTML_QuickForm2_Renderer::startForm() (Starts rendering a form, called before processing contained elements)

Parameters:

HTML_QuickForm2_Node   $form     Form being rendered

[ Top ]

startGroup   [line 488]

void startGroup( HTML_QuickForm2_Node $group)

Starts rendering a group, called before processing grouped elements
  • Access: public

Overrides HTML_QuickForm2_Renderer::startGroup() (Starts rendering a group, called before processing grouped elements)

Parameters:

HTML_QuickForm2_Node   $group     Group being rendered

[ Top ]

_renderContainer   [line 304]

void _renderContainer( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Container $container)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2_Container   $container     

[ Top ]

_renderElement   [line 220]

void _renderElement( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Element $element)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2_Element   $element     

[ Top ]

_renderErrorsGroup   [line 248]

void _renderErrorsGroup( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2 $form)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2   $form     

[ Top ]

_renderFieldset   [line 368]

void _renderFieldset( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Container_Fieldset $fieldset)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2_Container_Fieldset   $fieldset     

[ Top ]

_renderForm   [line 201]

void _renderForm( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2 $form)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2   $form     

[ Top ]

_renderGroup   [line 311]

void _renderGroup( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Container_Group $group)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2_Container_Group   $group     

[ Top ]

_renderGroupedElement   [line 242]

void _renderGroupedElement( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Element $element)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2_Element   $element     

[ Top ]

_renderHidden   [line 274]

void _renderHidden( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Element_InputHidden $hidden)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2_Element_InputHidden   $hidden     

[ Top ]

_renderHiddenGroup   [line 281]

void _renderHiddenGroup( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2 $form)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2   $form     

[ Top ]

_renderLabel   [line 387]

void _renderLabel( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Node $node)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2_Node   $node     

[ Top ]

_renderRepeat   [line 348]

void _renderRepeat( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2_Container_Repeat $repeat)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2_Container_Repeat   $repeat     

[ Top ]

_renderRequiredNote   [line 294]

void _renderRequiredNote( HTML_QuickForm2_Renderer $renderer, HTML_QuickForm2 $form)

  • Access: public

Parameters:

HTML_QuickForm2_Renderer   $renderer     
HTML_QuickForm2   $form     

[ Top ]

__toString   [line 713]

string __toString( )

Returns generated HTML
  • Access: public

[ Top ]


Documentation generated on Tue, 26 Jun 2012 15:30:10 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.