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

Class: HTML_QuickForm2_Renderer

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

Class Overview


Abstract base class for QuickForm2 renderers


Author(s):

Version:

  • Release: 2.0.0

Variables

Methods


Child classes:

HTML_QuickForm2_Renderer_Array
A renderer for HTML_QuickForm2 building an array of form elements
HTML_QuickForm2_Renderer_Callback
Callback renderer for QuickForm2
HTML_QuickForm2_Renderer_Proxy
Proxy class for HTML_QuickForm2 renderers and their plugins
HTML_QuickForm2_Renderer_Stub
A stub renderer to use with HTML_QuickForm2 when actual form output is done manually
HTML_QuickForm2_Renderer_Default
Default renderer for QuickForm2

Inherited Variables

Inherited Methods


Class Details

[line 72]
Abstract base class for QuickForm2 renderers

This class serves two main purposes:

  • Defines the API all renderers should implement (render*() methods);
  • Provides static methods for registering renderers and their plugins and factory() method for creating renderer instances.

Note that renderers should always be instantiated through factory(), in the other case it will not be possible to add plugins.



[ Top ]


Class Variables

$jsBuilder =

[line 113]

Javascript builder object
  • Access: protected



[ Top ]

$options = array(
        'group_hiddens' => true,
        'required_note' => '<em>*</em> denotes required fields.',
        'errors_prefix' => 'Invalid information entered:',
        'errors_suffix' => 'Please correct these fields.',
        'group_errors'  => false
    )

[line 101]

Renderer options

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 204]

HTML_QuickForm2_Renderer __construct( )

Constructor

Renderer instances should not be created directly, use factory()

  • Access: protected

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::__construct()
Constructor, adds a new 'static_labels' option
HTML_QuickForm2_Renderer_Proxy::__construct()
Constructor, sets proxied renderer and its plugins

[ Top ]

exportMethods   [line 216]

array exportMethods( )

Returns an array of "published" method names that should be callable through proxy

Methods defined in HTML_QuickForm2_Renderer are proxied automatically, only additional methods should be returned.

  • Access: protected

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::exportMethods()
HTML_QuickForm2_Renderer_Callback::exportMethods()
HTML_QuickForm2_Renderer_Stub::exportMethods()
HTML_QuickForm2_Renderer_Default::exportMethods()

[ Top ]

factory   [line 137]

HTML_QuickForm2_Renderer_Proxy factory( string $type)

Creates a new renderer instance of the given type

A renderer is always wrapped by a Proxy, which handles calling its "published" methods and methods of its plugins. Registered plugins are added automagically to the existing renderer instances so that

  1.  $foo HTML_QuickForm2_Renderer::factory('foo');
  2.  // Plugin implementing bar() method
  3.  HTML_QuickForm2_Renderer::registerPlugin('foo''Plugin_Foo_Bar');
  4.  $foo->bar();
will work.

  • Return: A renderer instance of the given type wrapped by a Proxy
  • Throws: HTML_QuickForm2_InvalidArgumentException If type name is unknown
  • Throws: HTML_QuickForm2_NotFoundException If class for the renderer can not be found and/or loaded from file
  • Access: public

Parameters:

string   $type     Type name (treated case-insensitively)

[ Top ]

finishContainer   [line 379]

void finishContainer( HTML_QuickForm2_Node $container)

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

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::finishContainer()
Implementations of abstract methods from HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Callback::finishContainer()
Finishes rendering a generic container, called after processing contained elements
HTML_QuickForm2_Renderer_Proxy::finishContainer()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::finishContainer()
Finishes rendering a generic container, called after processing contained elements
HTML_QuickForm2_Renderer_Default::finishContainer()
Finishes rendering a generic container, called after processing contained elements

Parameters:

HTML_QuickForm2_Node   $container     Container being rendered

[ Top ]

finishForm   [line 365]

void finishForm( HTML_QuickForm2_Node $form)

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

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::finishForm()
Implementations of abstract methods from HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Callback::finishForm()
Finishes rendering a form, called after processing contained elements
HTML_QuickForm2_Renderer_Proxy::finishForm()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::finishForm()
Finishes rendering a form, called after processing contained elements
HTML_QuickForm2_Renderer_Default::finishForm()
Finishes rendering a form, called after processing contained elements

Parameters:

HTML_QuickForm2_Node   $form     Form being rendered

[ Top ]

finishGroup   [line 393]

void finishGroup( HTML_QuickForm2_Node $group)

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

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::finishGroup()
Implementations of abstract methods from HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Callback::finishGroup()
Finishes rendering a group, called after processing grouped elements
HTML_QuickForm2_Renderer_Proxy::finishGroup()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::finishGroup()
Finishes rendering a group, called after processing grouped elements
HTML_QuickForm2_Renderer_Default::finishGroup()
Finishes rendering a group, called after processing grouped elements

Parameters:

HTML_QuickForm2_Node   $group     Group being rendered

[ Top ]

getJavascriptBuilder   [line 304]

HTML_QuickForm2_JavascriptBuilder getJavascriptBuilder( )

Returns the javascript builder object
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Renderer_Proxy::getJavascriptBuilder()
Proxies for methods defined in HTML_QuickForm2_Renderer

[ Top ]

getOption   [line 287]

mixed getOption( [string $name = null])

Returns the value(s) of the renderer option(s)
  • Return: value of $name parameter, array of all configuration parameters if $name is not given
  • Throws: HTML_QuickForm2_NotFoundException in case of unknown option
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Renderer_Proxy::getOption()
Proxies for methods defined in HTML_QuickForm2_Renderer

Parameters:

string   $name     parameter name

[ Top ]

methodExists   [line 228]

bool methodExists( string $name)

Checks whether a method is available in this object
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Renderer_Proxy::methodExists()
Checks whether a method is available in this object

Parameters:

string   $name     Method name

[ Top ]

register   [line 162]

void register( string $type, string $className, [string $includeFile = null])

Registers a new renderer type
  • Throws: HTML_QuickForm2_InvalidArgumentException if type already registered
  • Access: public

Parameters:

string   $type     Type name (treated case-insensitively)
string   $className     Class name
string   $includeFile     File containing the class, leave empty if class already loaded

[ Top ]

registerPlugin   [line 180]

void registerPlugin( string $type, string $className, [string $includeFile = null])

Registers a plugin for a renderer type
  • Throws: HTML_QuickForm2_InvalidArgumentException if plugin is already registered
  • Access: public

Parameters:

string   $type     Renderer type name (treated case-insensitively)
string   $className     Plugin class name
string   $includeFile     File containing the plugin class, leave empty if class already loaded

[ Top ]

renderElement   [line 344]

void renderElement( HTML_QuickForm2_Node $element)

Renders a generic element
  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::renderElement()
Implementations of abstract methods from HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Callback::renderElement()
Renders a generic element
HTML_QuickForm2_Renderer_Proxy::renderElement()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::renderElement()
Renders a generic element
HTML_QuickForm2_Renderer_Default::renderElement()
Renders a generic element

Parameters:

HTML_QuickForm2_Node   $element     Element being rendered

[ Top ]

renderHidden   [line 351]

void renderHidden( HTML_QuickForm2_Node $element)

Renders a hidden element
  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::renderHidden()
Implementations of abstract methods from HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Callback::renderHidden()
Renders a hidden element
HTML_QuickForm2_Renderer_Proxy::renderHidden()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::renderHidden()
Renders a hidden element
HTML_QuickForm2_Renderer_Default::renderHidden()
Renders a hidden element

Parameters:

HTML_QuickForm2_Node   $element     Hidden element being rendered

[ Top ]

reset   [line 337]

HTML_QuickForm2_Renderer reset( )

Resets the accumulated data

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

  • Abstract:
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::reset()
Resets the accumulated data
HTML_QuickForm2_Renderer_Callback::reset()
Resets the accumulated data
HTML_QuickForm2_Renderer_Proxy::reset()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::reset()
HTML_QuickForm2_Renderer_Default::reset()
Resets the accumulated data

[ Top ]

setJavascriptBuilder   [line 323]

HTML_QuickForm2_Renderer setJavascriptBuilder( [HTML_QuickForm2_JavascriptBuilder $builder = null])

Sets the javascript builder object

You may want to reuse the same builder object if outputting several forms on one page.

  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Renderer_Proxy::setJavascriptBuilder()
Proxies for methods defined in HTML_QuickForm2_Renderer

Parameters:

HTML_QuickForm2_JavascriptBuilder   $builder     

[ Top ]

setOption   [line 259]

HTML_QuickForm2_Renderer setOption( string|array $nameOrOptions, [mixed $value = null])

Sets the option(s) affecting renderer behaviour

The following options are available:

  • 'group_hiddens' - whether to group hidden elements together or render them where they were added (boolean)
  • 'group_errors' - whether to group error messages or render them alongside elements they apply to (boolean)
  • 'errors_prefix' - leading message for grouped errors (string)
  • 'errors_suffix' - trailing message for grouped errors (string)
  • 'required_note' - note displayed if the form contains required elements (string)

  • Throws: HTML_QuickForm2_NotFoundException in case of unknown option
  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Renderer_Proxy::setOption()
Proxies for methods defined in HTML_QuickForm2_Renderer

Parameters:

string|array   $nameOrOptions     option name or array ('option name' => 'option value')
mixed   $value     parameter value if $nameOrConfig is not an array

[ Top ]

startContainer   [line 372]

void startContainer( HTML_QuickForm2_Node $container)

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

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::startContainer()
Implementations of abstract methods from HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Callback::startContainer()
Starts rendering a generic container, called before processing contained elements
HTML_QuickForm2_Renderer_Proxy::startContainer()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::startContainer()
Starts rendering a generic container, called before processing contained elements
HTML_QuickForm2_Renderer_Default::startContainer()
Starts rendering a generic container, called before processing contained elements

Parameters:

HTML_QuickForm2_Node   $container     Container being rendered

[ Top ]

startForm   [line 358]

void startForm( HTML_QuickForm2_Node $form)

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

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::startForm()
Implementations of abstract methods from HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Callback::startForm()
Starts rendering a form, called before processing contained elements
HTML_QuickForm2_Renderer_Proxy::startForm()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::startForm()
Starts rendering a form, called before processing contained elements
HTML_QuickForm2_Renderer_Default::startForm()
Starts rendering a form, called before processing contained elements

Parameters:

HTML_QuickForm2_Node   $form     Form being rendered

[ Top ]

startGroup   [line 386]

void startGroup( HTML_QuickForm2_Node $group)

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

Overridden in child classes as:

HTML_QuickForm2_Renderer_Array::startGroup()
Implementations of abstract methods from HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Callback::startGroup()
Starts rendering a group, called before processing grouped elements
HTML_QuickForm2_Renderer_Proxy::startGroup()
Proxies for methods defined in HTML_QuickForm2_Renderer
HTML_QuickForm2_Renderer_Stub::startGroup()
Starts rendering a group, called before processing grouped elements
HTML_QuickForm2_Renderer_Default::startGroup()
Starts rendering a group, called before processing grouped elements

Parameters:

HTML_QuickForm2_Node   $group     Group being rendered

[ Top ]


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