\Pop\FormForm

Form class

Summary

Methods
Properties
Constants
__construct()
create()
parseString()
parseFile()
getNodeName()
getNodeValue()
getNodeContent()
getTextContent()
setNodeName()
setNodeValue()
addNodeValue()
setAsCData()
isCData()
setAttribute()
setAttributes()
hasAttribute()
getAttribute()
getAttributes()
removeAttribute()
isChildrenFirst()
setChildrenFirst()
preserveWhiteSpace()
render()
__toString()
getIndent()
setIndent()
getParent()
setParent()
addChild()
addChildren()
hasChildren()
hasChildNodes()
getChild()
getChildren()
getChildNodes()
removeChild()
removeChildren()
createFromConfig()
createFromFieldsetConfig()
createFieldset()
setAction()
setMethod()
getAction()
getMethod()
addFieldset()
removeFieldset()
getFieldset()
addColumn()
hasColumn()
getColumn()
removeColumn()
getCurrent()
setCurrent()
getLegend()
setLegend()
addField()
addFields()
addFieldFromConfig()
addFieldsFromConfig()
addFieldsetsFromConfig()
insertFieldBefore()
insertFieldAfter()
count()
toArray()
getField()
getFields()
removeField()
getFieldValue()
setFieldValue()
setFieldValues()
getIterator()
addFilter()
clearFilters()
filterValue()
filterValues()
isValid()
getErrors()
getAllErrors()
reset()
clearTokens()
prepare()
prepareForView()
__set()
__get()
__isset()
__unset()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
No public properties found
No constants found
No protected methods found
$nodeName
$nodeValue
$cData
$childrenFirst
$attributes
$preserveWhiteSpace
$childNodes
$indent
$output
$parent
$fieldsets
$columns
$current
$filters
N/A
No private methods found
No private properties found
N/A

Properties

$nodeName

$nodeName : string

Child element node name

Type

string

$nodeValue

$nodeValue : string

Child element node value

Type

string

$cData

$cData : boolean

Child element node value CDATA flag

Type

boolean

$childrenFirst

$childrenFirst : boolean

Flag to render children before node value or not

Type

boolean

$attributes

$attributes : array

Child element attributes

Type

array

$preserveWhiteSpace

$preserveWhiteSpace : boolean

Flag to preserve whitespace

Type

boolean

$childNodes

$childNodes : array

Object child nodes

Type

array

$indent

$indent : string

Indentation for formatting purposes

Type

string

$output

$output : string

Child output

Type

string

$fieldsets

$fieldsets : array

Field fieldsets

Type

array

$columns

$columns : array

Form columns

Type

array

$current

$current : integer

Current field fieldset

Type

integer

$filters

$filters : array

Filters

Type

array

Methods

__construct()

__construct(array  $fields = null, string  $action = null, string  $method = 'post') 

Constructor

Instantiate the form object

Parameters

array $fields
string $action
string $method

create()

create(string  $name, string  $value = null, array  $options = array()) : \Pop\Dom\Child

Static factory method to create a child object

Parameters

string $name
string $value
array $options

Returns

\Pop\Dom\Child

parseString()

parseString(string  $string) : \Pop\Dom\Child|array

Static method to parse an XML/HTML string

Parameters

string $string

Returns

\Pop\Dom\Child|array

parseFile()

parseFile(string  $file) : \Pop\Dom\Child

Static method to parse an XML/HTML string from a file

Parameters

string $file

Throws

\Pop\Dom\Exception

Returns

\Pop\Dom\Child

getNodeName()

getNodeName() : string

Return the child node name

Returns

string

getNodeValue()

getNodeValue() : string

Return the child node value

Returns

string

getNodeContent()

getNodeContent(boolean  $ignoreWhiteSpace = false) : string

Return the child node content, including tags, etc

Parameters

boolean $ignoreWhiteSpace

Returns

string

getTextContent()

getTextContent(boolean  $ignoreWhiteSpace = false) : string

Return the child node content, including tags, etc

Parameters

boolean $ignoreWhiteSpace

Returns

string

setNodeName()

setNodeName(string  $name) : \Pop\Dom\Child

Set the child node name

Parameters

string $name

Returns

\Pop\Dom\Child

setNodeValue()

setNodeValue(string  $value) : \Pop\Dom\Child

Set the child node value

Parameters

string $value

Returns

\Pop\Dom\Child

addNodeValue()

addNodeValue(string  $value) : \Pop\Dom\Child

Add to the child node value

Parameters

string $value

Returns

\Pop\Dom\Child

setAsCData()

setAsCData(boolean  $cData = true) : \Pop\Dom\Child

Set the child node value as CDATA

Parameters

boolean $cData

Returns

\Pop\Dom\Child

isCData()

isCData() : boolean

Determine if the child node value is CDATA

Returns

boolean

setAttribute()

setAttribute(string  $a, string  $v) : \Pop\Form\Form

Method to set an attribute

Parameters

string $a
string $v

Returns

\Pop\Form\Form

setAttributes()

setAttributes(array  $a) : \Pop\Form\Form

Method to set attributes

Parameters

array $a

Returns

\Pop\Form\Form

hasAttribute()

hasAttribute(string  $name) : boolean

Determine if the child object has an attribute

Parameters

string $name

Returns

boolean

getAttribute()

getAttribute(string  $name) : string

Get the attribute of the child object

Parameters

string $name

Returns

string

getAttributes()

getAttributes() : array

Get the attributes of the child object

Returns

array

removeAttribute()

removeAttribute(string  $a) : \Pop\Dom\Child

Remove an attribute from the child element object

Parameters

string $a

Returns

\Pop\Dom\Child

isChildrenFirst()

isChildrenFirst() : boolean

Determine if child nodes render first, before the node value

Returns

boolean

setChildrenFirst()

setChildrenFirst(boolean  $first = true) : \Pop\Dom\Child

Set whether child nodes render first, before the node value

Parameters

boolean $first

Returns

\Pop\Dom\Child

preserveWhiteSpace()

preserveWhiteSpace(boolean  $preserve = true) : \Pop\Dom\Child

Set whether to preserve whitespace

Parameters

boolean $preserve

Returns

\Pop\Dom\Child

render()

render(integer  $depth, string  $indent = null, boolean  $inner = false) : mixed

Render the form object

Parameters

integer $depth
string $indent
boolean $inner

Returns

mixed

__toString()

__toString() : string

Render and return the form object as a string

Returns

string

getIndent()

getIndent() : string

Return the indent

Returns

string

setIndent()

setIndent(string  $indent) : mixed

Set the indent

Parameters

string $indent

Returns

mixed

addChild()

addChild(mixed  $c) : mixed

Add a child to the object

Parameters

mixed $c

Throws

\InvalidArgumentException

Returns

mixed

addChildren()

addChildren(  $children) : mixed

Add children to the object

Parameters

$children

Throws

\Pop\Dom\Exception

Returns

mixed

hasChildren()

hasChildren() : boolean

Get whether or not the child object has children

Returns

boolean

hasChildNodes()

hasChildNodes() : boolean

Get whether or not the child object has children (alias)

Returns

boolean

getChild()

getChild(integer  $i) : \Pop\Dom\Child

Get the child nodes of the object

Parameters

integer $i

Returns

\Pop\Dom\Child

getChildren()

getChildren() : array

Get the child nodes of the object

Returns

array

getChildNodes()

getChildNodes() : array

Get the child nodes of the object (alias)

Returns

array

removeChild()

removeChild(integer  $i) : void

Remove all child nodes from the object

Parameters

integer $i

removeChildren()

removeChildren() : void

Remove all child nodes from the object

createFromConfig()

createFromConfig(array  $config, string  $action = null, string  $method = 'post') : \Pop\Form\Form

Method to create form object and fields from config

Parameters

array $config
string $action
string $method

Returns

\Pop\Form\Form

createFromFieldsetConfig()

createFromFieldsetConfig(array  $config, string  $container = null, string  $action = null, string  $method = 'post') : \Pop\Form\Form

Method to create form object and fields from config

Parameters

array $config
string $container
string $action
string $method

Returns

\Pop\Form\Form

createFieldset()

createFieldset(string  $legend = null, string  $container = null) : \Pop\Form\Fieldset

Method to create a new fieldset object

Parameters

string $legend
string $container

Returns

\Pop\Form\Fieldset

setAction()

setAction(string  $action) : \Pop\Form\Form

Method to set action

Parameters

string $action

Returns

\Pop\Form\Form

setMethod()

setMethod(string  $method) : \Pop\Form\Form

Method to set method

Parameters

string $method

Returns

\Pop\Form\Form

getAction()

getAction() : string

Method to get action

Returns

string

getMethod()

getMethod() : string

Method to get method

Returns

string

addFieldset()

addFieldset(\Pop\Form\Fieldset  $fieldset) : \Pop\Form\Form

Method to add fieldset

Parameters

\Pop\Form\Fieldset $fieldset

Returns

\Pop\Form\Form

removeFieldset()

removeFieldset(integer  $i) : \Pop\Form\Form

Method to remove fieldset

Parameters

integer $i

Returns

\Pop\Form\Form

getFieldset()

getFieldset() : \Pop\Form\Fieldset

Method to get current fieldset

Returns

\Pop\Form\Fieldset

addColumn()

addColumn(mixed  $fieldsets, string  $class = null) : \Pop\Form\Form

Method to add form column

Parameters

mixed $fieldsets
string $class

Returns

\Pop\Form\Form

hasColumn()

hasColumn(string  $class) : boolean

Method to determine if form has a column

Parameters

string $class

Returns

boolean

getColumn()

getColumn(string  $class) : array

Method to get form column

Parameters

string $class

Returns

array

removeColumn()

removeColumn(string  $class) : \Pop\Form\Form

Method to remove form column

Parameters

string $class

Returns

\Pop\Form\Form

getCurrent()

getCurrent() : integer

Method to get current fieldset index

Returns

integer

setCurrent()

setCurrent(integer  $i) : \Pop\Form\Form

Method to get current fieldset index

Parameters

integer $i

Returns

\Pop\Form\Form

getLegend()

getLegend() : string

Method to get the legend of the current fieldset

Returns

string

setLegend()

setLegend(string  $legend) : \Pop\Form\Form

Method to set the legend of the current fieldset

Parameters

string $legend

Returns

\Pop\Form\Form

addFields()

addFields(array  $fields) : \Pop\Form\Form

Method to add form fields

Parameters

array $fields

Returns

\Pop\Form\Form

addFieldFromConfig()

addFieldFromConfig(string  $name, array  $field) : \Pop\Form\Form

Method to add a form field from a config

Parameters

string $name
array $field

Returns

\Pop\Form\Form

addFieldsFromConfig()

addFieldsFromConfig(array  $config) : \Pop\Form\Form

Method to add form fields from config

Parameters

array $config

Returns

\Pop\Form\Form

addFieldsetsFromConfig()

addFieldsetsFromConfig(array  $fieldsets, string  $container = null) : \Pop\Form\Form

Method to add form fieldsets from config

Parameters

array $fieldsets
string $container

Returns

\Pop\Form\Form

insertFieldBefore()

insertFieldBefore(string  $name, \Pop\Form\Element\AbstractElement  $field) : \Pop\Form\Form

Method to insert a field before another one

Parameters

string $name
\Pop\Form\Element\AbstractElement $field

Returns

\Pop\Form\Form

insertFieldAfter()

insertFieldAfter(string  $name, \Pop\Form\Element\AbstractElement  $field) : \Pop\Form\Form

Method to insert a field after another one

Parameters

string $name
\Pop\Form\Element\AbstractElement $field

Returns

\Pop\Form\Form

count()

count() : integer

Method to get the count of elements in the form

Returns

integer

toArray()

toArray() : array

Method to get the field values as an array

Returns

array

getField()

getField(string  $name) : \Pop\Form\Element\AbstractElement

Method to get a field element object

Parameters

string $name

Returns

\Pop\Form\Element\AbstractElement

getFields()

getFields() : array

Method to get field element objects

Returns

array

removeField()

removeField(string  $field) : \Pop\Form\Form

Method to remove a form field

Parameters

string $field

Returns

\Pop\Form\Form

getFieldValue()

getFieldValue(string  $name) : mixed

Method to get a field element value

Parameters

string $name

Returns

mixed

setFieldValue()

setFieldValue(string  $name, mixed  $value) : \Pop\Form\Form

Method to set a field element value

Parameters

string $name
mixed $value

Returns

\Pop\Form\Form

setFieldValues()

setFieldValues(array  $values) : \Pop\Form\Form

Method to set field element values

Parameters

array $values

Returns

\Pop\Form\Form

getIterator()

getIterator() : \ArrayIterator

Method to iterate over the form elements

Returns

\ArrayIterator

addFilter()

addFilter(mixed  $call, mixed  $params = null, mixed  $excludeByType = null, mixed  $excludeByName = null) : \Pop\Form\Form

Add filter

Parameters

mixed $call
mixed $params
mixed $excludeByType
mixed $excludeByName

Returns

\Pop\Form\Form

clearFilters()

clearFilters() : \Pop\Form\Form

Clear filters

Returns

\Pop\Form\Form

filterValue()

filterValue(mixed  $value) : mixed

Filter value with the filters in the form object

Parameters

mixed $value

Returns

mixed

filterValues()

filterValues(array  $values = null) : mixed

Filter values with the filters in the form object

Parameters

array $values

Returns

mixed

isValid()

isValid() : boolean

Determine whether or not the form object is valid

Returns

boolean

getErrors()

getErrors(string  $name) : array

Get form element errors for a field.

Parameters

string $name

Returns

array

getAllErrors()

getAllErrors() : array

Get all form element errors

Returns

array

reset()

reset() : \Pop\Form\Form

Method to reset and clear any form field values

Returns

\Pop\Form\Form

clearTokens()

clearTokens() : \Pop\Form\Form

Method to clear any security tokens

Returns

\Pop\Form\Form

prepare()

prepare() : \Pop\Form\Form

Prepare form object for rendering

Returns

\Pop\Form\Form

prepareForView()

prepareForView() : array

Prepare form object for rendering with a view

Returns

array

__set()

__set(string  $name, mixed  $value) : void

Set method to set the property to the value of fields[$name]

Parameters

string $name
mixed $value

__get()

__get(string  $name) : mixed

Get method to return the value of fields[$name]

Parameters

string $name

Throws

\Pop\Form\Exception

Returns

mixed

__isset()

__isset(string  $name) : boolean

Return the isset value of fields[$name]

Parameters

string $name

Returns

boolean

__unset()

__unset(string  $name) : void

Unset fields[$name]

Parameters

string $name

offsetExists()

offsetExists(mixed  $offset) : boolean

ArrayAccess offsetExists

Parameters

mixed $offset

Returns

boolean

offsetGet()

offsetGet(mixed  $offset) : mixed

ArrayAccess offsetGet

Parameters

mixed $offset

Returns

mixed

offsetSet()

offsetSet(mixed  $offset, mixed  $value) : void

ArrayAccess offsetSet

Parameters

mixed $offset
mixed $value

offsetUnset()

offsetUnset(mixed  $offset) : void

ArrayAccess offsetUnset

Parameters

mixed $offset