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

Class: HTML_QuickForm2_Container

Source Location: /HTML_QuickForm2-0.2.0/QuickForm2/Container.php

Class Overview

HTML_Common2
   |
   --HTML_QuickForm2_Node
      |
      --HTML_QuickForm2_Container

Abstract base class for simple QuickForm2 containers


Author(s):

Version:

  • Release: 0.2.0

Variables

Methods


Child classes:

HTML_QuickForm2
Class representing a HTML form
HTML_QuickForm2_Container_Fieldset
Concrete implementation of a container for fieldsets

Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Node

HTML_QuickForm2_Node::__construct()
Class constructor
HTML_QuickForm2_Node::addRule()
Adds a validation rule
HTML_QuickForm2_Node::createRule()
Creates a validation rule
HTML_QuickForm2_Node::generateId()
Generates an id for the element
HTML_QuickForm2_Node::getContainer()
Returns the element containing current
HTML_QuickForm2_Node::getDataSources()
Returns the data sources for this element
HTML_QuickForm2_Node::getError()
Returns the error message for the element
HTML_QuickForm2_Node::getId()
Returns the element's id
HTML_QuickForm2_Node::getLabel()
Returns the element's label(s)
HTML_QuickForm2_Node::getName()
Returns the element's name
HTML_QuickForm2_Node::getType()
Returns the element's type
HTML_QuickForm2_Node::getValue()
Returns the element's value
HTML_QuickForm2_Node::isRequired()
Checks whether an element is required
HTML_QuickForm2_Node::persistentFreeze()
Changes the element's persistent freeze behaviour
HTML_QuickForm2_Node::setContainer()
Adds the link to the element containing current
HTML_QuickForm2_Node::setError()
Sets the error message to the element
HTML_QuickForm2_Node::setId()
Sets the elements id
HTML_QuickForm2_Node::setLabel()
Sets the element's label(s)
HTML_QuickForm2_Node::setName()
Sets the element's name
HTML_QuickForm2_Node::setValue()
Sets the element's value
HTML_QuickForm2_Node::storeId()
Stores the explicitly given id to prevent duplicate id generation
HTML_QuickForm2_Node::toggleFrozen()
Changes the element's frozen status
HTML_QuickForm2_Node::updateValue()
Called when the element needs to update its value from form's data sources
HTML_QuickForm2_Node::validate()
Performs the server-side validation

Class Details

[line 60]
Abstract base class for simple QuickForm2 containers


[ Top ]


Class Variables

$elements = array()

[line 67]

Array of elements contained in this container
  • Access: protected

Type:   array


[ Top ]

$watchedAttributes = array('id', 'name')

[line 74]

'name' and 'id' attributes should be always present and their setting should go through setName() and setId().
  • Access: protected

Type:   array


[ Top ]



Method Detail

addElement   [line 254]

HTML_QuickForm2_Node addElement( string|HTML_QuickForm2_Node $elementOrType, [mixed $name = null], [mixed $attributes = null], [array $data = array()])

Appends an element to the container (possibly creating it first)

If the first parameter is an instance of HTML_QuickForm2_Node then all other parameters are ignored and the method just calls appendChild(). In the other case the element is first created via HTML_QuickForm2_Factory::createElement() and then added via the same method. This is a convenience method to reduce typing and ease porting from HTML_QuickForm.

  • Return: Added element
  • Throws: HTML_QuickForm2_NotFoundException
  • Throws: HTML_QuickForm2_InvalidArgumentException
  • Access: public

Parameters:

string|HTML_QuickForm2_Node   $elementOrType   —  Either type name (treated case-insensitively) or an element instance
mixed   $name   —  Element name
mixed   $attributes   —  Element attributes
array   $data   —  Element-specific data

[ Top ]

appendChild   [line 225]

HTML_QuickForm2_Node appendChild( HTML_QuickForm2_Node $element)

Appends an element to the container

If the element was previously added to the container or to another container, it is first removed there.

  • Return: Added element
  • Throws: HTML_QuickForm2_InvalidArgumentException
  • Access: public

Parameters:

HTML_QuickForm2_Node   $element   —  Element to add

[ Top ]

arrayMerge   [line 193]

array arrayMerge( array $a, array $b)

Merges two arrays

Merges two arrays like the PHP function array_merge_recursive does, the difference being that existing integer keys will not be renumbered.

  • Return: resulting array
  • Access: protected

Parameters:

array   $a   — 
array   $b   — 

[ Top ]

count   [line 385]

int count( )

Returns the number of elements in the container
  • Access: public

[ Top ]

getElementById   [line 299]

HTML_QuickForm2_Node|null getElementById( string $id)

Returns an element if its id is found
  • Access: public

Parameters:

string   $id   —  Element id to find

[ Top ]

getElements   [line 210]

array getElements( )

Returns an array of this container's elements
  • Return: Container elements
  • Access: public

[ Top ]

getElementsByName   [line 315]

array getElementsByName( string $name)

Returns an array of elements which name corresponds to element
  • Access: public

Parameters:

string   $name   —  Elements name to find

[ Top ]

getId   [line 108]

void getId( )

  • Access: public

Overrides HTML_QuickForm2_Node::getId() (Returns the element's id)
[ Top ]

getIterator   [line 362]

HTML_QuickForm2_ContainerIterator getIterator( )

Returns a recursive iterator for the container elements
  • Access: public

[ Top ]

getName   [line 97]

void getName( )

  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container_Fieldset::getName()

Overrides HTML_QuickForm2_Node::getName() (Returns the element's name)
[ Top ]

getRecursiveIterator   [line 372]

RecursiveIteratorIterator getRecursiveIterator( )

Returns a recursive iterator iterator for the container elements
  • Access: public

[ Top ]

getValue   [line 153]

array|null getValue( )

Returns the element's value

The default implementation for Containers is to return an array with contained elements' values. The array is indexed the same way $_GET and $_POST arrays would be for these elements.

  • Access: public

Overrides HTML_QuickForm2_Node::getValue() (Returns the element's value)
[ Top ]

insertBefore   [line 335]

HTML_QuickForm2_Node insertBefore( HTML_QuickForm2_Node $element, [HTML_QuickForm2_Node $reference = null])

Inserts an element in the container

If the reference object is not given, the element will be appended.

  • Return: Inserted element
  • Access: public

Parameters:

HTML_QuickForm2_Node   $element   —  Element to insert
HTML_QuickForm2_Node   $reference   —  Reference to insert before

[ Top ]

onAttributeChange   [line 76]

void onAttributeChange( $name, [ $value = null])

  • Access: protected

Overridden in child classes as:

HTML_QuickForm2::onAttributeChange()
HTML_QuickForm2_Container_Fieldset::onAttributeChange()

Parameters:

   $name   — 
   $value   — 

[ Top ]

persistentFreeze   [line 134]

void persistentFreeze( [ $persistent = null])

  • Access: public

Overrides HTML_QuickForm2_Node::persistentFreeze() (Changes the element's persistent freeze behaviour)

Parameters:

   $persistent   — 

[ Top ]

removeChild   [line 274]

HTML_QuickForm2_Node removeChild( HTML_QuickForm2_Node $element)

Removes the element from this container

If the reference object is not given, the element will be appended.

  • Return: Removed object
  • Access: public

Parameters:

HTML_QuickForm2_Node   $element   —  Element to remove

[ Top ]

setId   [line 113]

void setId( [ $id = null])

  • Access: public

Overridden in child classes as:

HTML_QuickForm2::setId()

Overrides HTML_QuickForm2_Node::setId() (Sets the elements id)

Parameters:

   $id   — 

[ Top ]

setName   [line 102]

void setName( $name)

  • Access: public

Overridden in child classes as:

HTML_QuickForm2_Container_Fieldset::setName()

Overrides HTML_QuickForm2_Node::setName() (Sets the element's name)

Parameters:

   $name   — 

[ Top ]

toggleFrozen   [line 124]

void toggleFrozen( [ $freeze = null])

  • Access: public

Overrides HTML_QuickForm2_Node::toggleFrozen() (Changes the element's frozen status)

Parameters:

   $freeze   — 

[ Top ]

updateValue   [line 396]

void updateValue( )

Called when the element needs to update its value from form's data sources

The default behaviour is just to call the updateValue() methods of contained elements, since default Container doesn't have any value itself

  • Access: protected

Overrides HTML_QuickForm2_Node::updateValue() (Called when the element needs to update its value from form's data sources)
[ Top ]

validate   [line 411]

boolean validate( )

Performs the server-side validation

This method also calls validate() on all contained elements.

  • Return: Whether the container and all contained elements are valid
  • Access: protected

Overridden in child classes as:

HTML_QuickForm2::validate()
Performs the server-side validation

Overrides HTML_QuickForm2_Node::validate() (Performs the server-side validation)
[ Top ]

__call   [line 436]

HTML_QuickForm2_Node __call( mixed $m, mixed $a, array 2)

Appends an element to the container, creating it first

The element will be created via HTML_QuickForm2_Factory::createElement() and then added via the appendChild() method. The element type is deduced from the method name. Camelcases will be converted to underscores and lowercased. This is a convenience method to reduce typing.

  • Return: Added element
  • Throws: HTML_QuickForm2_NotFoundException
  • Throws: HTML_QuickForm2_InvalidArgumentException
  • Access: public

Parameters:

array   2   —  Element-specific data
mixed   $m   —  Element name
mixed   $a   —  Element attributes

[ Top ]


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