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

Class: HTML_QuickForm2_Container

Source Location: /HTML_QuickForm2-0.1.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.1.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::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::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::persistentFreeze()
Changes the element's persistent freeze behaviour
HTML_QuickForm2_Node::setContainer()
Adds the link to the element containing current
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

Class Details

[line 65]
Abstract base class for simple QuickForm2 containers


[ Top ]


Class Variables

$elements = array()

[line 72]

Array of elements contained in this container
  • Access: protected

Type:   array


[ Top ]

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

[line 79]

'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 258]

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

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   $data   —  Element-specific data
mixed   $label   —  Element label
mixed   $attributes   —  Element attributes

[ Top ]

appendChild   [line 228]

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

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

int count( )

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

[ Top ]

getElementById   [line 303]

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

array getElements( )

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

[ Top ]

getElementsByName   [line 319]

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

void getId( )

  • Access: public

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

getIterator   [line 366]

HTML_QuickForm2_ContainerIterator getIterator( )

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

[ Top ]

getName   [line 102]

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

RecursiveIteratorIterator getRecursiveIterator( )

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

[ Top ]

getValue   [line 156]

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

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

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

void persistentFreeze( [ $persistent = null])

  • Access: public

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

Parameters:

   $persistent   — 

[ Top ]

removeChild   [line 278]

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

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

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

void toggleFrozen( [ $freeze = null])

  • Access: public

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

Parameters:

   $freeze   — 

[ Top ]

updateValue   [line 400]

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 ]


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