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

Class: HTML_QuickForm2_Renderer_Array

Source Location: /HTML_QuickForm2-0.3.0/QuickForm2/Renderer/Array.php

Class Overview

HTML_QuickForm2_Renderer
   |
   --HTML_QuickForm2_Renderer_Array

A renderer for HTML_QuickForm2 building an array of form elements


Author(s):

Version:

  • Release: 0.3.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::getOption()
Returns the value(s) of the renderer option(s)
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::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 129]
A renderer for HTML_QuickForm2 building an array of form elements

Based on Array renderer from HTML_QuickForm 3.x package

The form array structure is the following:

 array(
   'id'               => form's "id" attribute (string),
   'frozen'           => whether the form is frozen (bool),
   'attributes'       => attributes for <form> tag (string),
   // if form contains required elements:
   'required_note'    => note about the required elements (string),
   // if 'group_hiddens' option is true:
   'hidden'           => array with html of hidden elements (array),
   // if 'group_errors' option is true:
   'errors' => array(
     '1st element id' => 'Error for the 1st element',
     ...
     'nth element id' => 'Error for the nth element'
   ),
   'elements' => array(
     element_1,
     ...
     element_N
   )
 );
Where element_i is an array of the form
 array(
   'id'        => element id (string),
   'type'      => type of the element (string),
   'frozen'    => whether element is frozen (bool),
   // if element has a label:
   'label'     => 'label for the element',
   // note that if 'static_labels' option is true and element's label is an
   // array then there will be several 'label_*' keys corresponding to
   // labels' array keys
   'required'  => whether element is required (bool),
   // if a validation error is present and 'group_errors' option is false:
   'error'     => error associated with the element (string),
   // if some style was associated with an element:
   'style'     => 'some information about element style (e.g. for Smarty)',

   // if element is not a Container
   'value'     => element value (mixed),
   'html'      => HTML for the element (string),

   // if element is a Container
   'attributes' => container attributes (string)
   // only for groups, if separator is set:
   'separator'  => separator for group elements (mixed),
   'elements'   => array(
     element_1,
     ...
     element_N
   )
 );

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:



[ Top ]


Class Variables

$array = array()

[line 135]

An array being generated
  • Access: public

Type:   array


[ Top ]

$containers = array()

[line 141]

Array with references to 'elements' fields of currently processed containers
  • Access: public

Type:   unknown_type


[ Top ]

$hasRequired =  false

[line 147]

Whether the form contains required elements
  • Access: public

Type:   bool


[ Top ]

$styles = array()

[line 153]

Additional style information for elements
  • Access: public

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 158]

HTML_QuickForm2_Renderer_Array __construct( )

Constructor, adds a new 'static_labels' option
  • Access: protected

Overrides HTML_QuickForm2_Renderer::__construct() (Constructor)
[ Top ]

buildCommonFields   [line 205]

array buildCommonFields( HTML_QuickForm2_Node $element)

Creates an array with fields that are common to all elements
  • Access: public

Parameters:

HTML_QuickForm2_Node   $element   —  Element being rendered

[ Top ]

exportMethods   [line 163]

void exportMethods( )

  • Access: protected

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

finishContainer   [line 352]

void finishContainer( HTML_QuickForm2_Node $container)

Implementations of abstract methods from HTML_QuickForm2_Renderer
  • Access: public

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

Parameters:

HTML_QuickForm2_Node   $container   — 

[ Top ]

finishForm   [line 336]

void finishForm( HTML_QuickForm2_Node $form)

Implementations of abstract methods from HTML_QuickForm2_Renderer
  • Access: public

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

Parameters:

HTML_QuickForm2_Node   $form   — 

[ Top ]

finishGroup   [line 368]

void finishGroup( HTML_QuickForm2_Node $group)

Implementations of abstract methods from HTML_QuickForm2_Renderer
  • Access: public

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

Parameters:

HTML_QuickForm2_Node   $group   — 

[ Top ]

pushContainer   [line 264]

void pushContainer( array $container)

Stores an array representing a Container in the form array
  • Access: public

Parameters:

array   $container   — 

[ Top ]

pushScalar   [line 247]

void pushScalar( array $element)

Stores an array representing "scalar" element in the form array
  • Access: public

Parameters:

array   $element   — 

[ Top ]

renderElement   [line 303]

void renderElement( HTML_QuickForm2_Node $element)

Implementations of abstract methods from HTML_QuickForm2_Renderer
  • Access: public

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

Parameters:

HTML_QuickForm2_Node   $element   — 

[ Top ]

renderHidden   [line 313]

void renderHidden( HTML_QuickForm2_Node $element)

Implementations of abstract methods from HTML_QuickForm2_Renderer
  • Access: public

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

Parameters:

HTML_QuickForm2_Node   $element   — 

[ Top ]

reset   [line 180]

HTML_QuickForm2_Renderer_Array 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

[ Top ]

setStyleForId   [line 290]

HTML_QuickForm2_Renderer_Array setStyleForId( string|array $idOrStyles, [sting $style = null])

Sets a style for element rendering

"Style" is some information that is opaque to Array Renderer but may be of use to e.g. template engine that receives the resultant array.

  • Access: public

Parameters:

string|array   $idOrStyles   —  Element id or array ('element id' => 'style')
sting   $style   —  Element style if $idOrStyles is not an array

[ Top ]

startContainer   [line 344]

void startContainer( HTML_QuickForm2_Node $container)

Implementations of abstract methods from HTML_QuickForm2_Renderer
  • Access: public

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

Parameters:

HTML_QuickForm2_Node   $container   — 

[ Top ]

startForm   [line 322]

void startForm( HTML_QuickForm2_Node $form)

Implementations of abstract methods from HTML_QuickForm2_Renderer
  • Access: public

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

Parameters:

HTML_QuickForm2_Node   $form   — 

[ Top ]

startGroup   [line 357]

void startGroup( HTML_QuickForm2_Node $group)

Implementations of abstract methods from HTML_QuickForm2_Renderer
  • Access: public

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

Parameters:

HTML_QuickForm2_Node   $group   — 

[ Top ]

toArray   [line 194]

array toArray( )

Returns the resultant array
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:34:58 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.