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

Class: HTML_QuickForm2_Renderer_Array

Source Location: /HTML_QuickForm2-2.1.0/HTML/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: 2.1.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 110]
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 form has some javascript for setup or validation:
   'javascript'       => form javascript (string)
   // 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)
   // if element is a Group
   'class'      => element's 'class' attribute
   // only for groups, if separator is set:
   'separator'  => separator for group elements (array),
   '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 116]

An array being generated
  • Access: public

Type:   array


[ Top ]

$containers = array()

[line 122]

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

Type:   array


[ Top ]

$hasRequired =  false

[line 128]

Whether the form contains required elements
  • Access: public

Type:   bool


[ Top ]

$styles = array()

[line 134]

Additional style information for elements
  • Access: public

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 139]

HTML_QuickForm2_Renderer_Array __construct( )

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

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

buildCommonContainerFields   [line 224]

array buildCommonContainerFields( HTML_QuickForm2_Node $container)

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

Parameters:

HTML_QuickForm2_Node   $container   —  Container being rendered

[ Top ]

buildCommonFields   [line 186]

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 144]

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 346]

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 328]

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 371]

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 254]

void pushContainer( array $container)

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

Parameters:

array   $container   — 

[ Top ]

pushScalar   [line 237]

void pushScalar( array $element)

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

Parameters:

array   $element   — 

[ Top ]

renderElement   [line 294]

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 305]

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 160]

$this 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 ]

setStyleForId   [line 281]

$this setStyleForId( string|array $idOrStyles, [mixed $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')
mixed   $style   —  Element style if $idOrStyles is not an array

[ Top ]

startContainer   [line 337]

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 314]

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 351]

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 174]

array toArray( )

Returns the resultant array
  • Access: public

[ Top ]


Documentation generated on Wed, 10 Apr 2019 08:56:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.