package Default
inherited_from \Zend\Form\Fieldset

 Methods

Make a deep clone of a fieldset

__clone() : void
Inherited

__construct()

__construct(null|integer|string $name = null, array $options = array()
Inherited

Parameters

$name

nullintegerstring

Optional name for the element

$options

array

Optional options for the element

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Add an element or fieldset

add(array|\Traversable|\Zend\Form\ElementInterface $elementOrFieldset, array $flags = array()) : \Zend\Form\Fieldset | \Zend\Form\FieldsetInterface
Inherited

$flags could contain metadata such as the alias under which to register the element or fieldset, order in which to prioritize it, etc.

todo Should we detect if the element/fieldset name conflicts?
inherited_from \Zend\Form\FieldsetInterface::add()

Parameters

$elementOrFieldset

array\Traversable\Zend\Form\ElementInterface

$flags

array

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\Fieldset\Zend\Form\FieldsetInterface

Get allow add

allowAdd() : boolean

Returns

boolean

Checks if the object can be set in this fieldset

allowObjectBinding(object $object) : boolean
inherited_from \Zend\Form\Fieldset::allowObjectBinding()

Parameters

$object

object

Returns

boolean

Checks if the object can be set in this fieldset

allowObjectBinding(object $object) : boolean
Inherited
inherited_from \Zend\Form\FieldsetInterface::allowObjectBinding()

Parameters

$object

object

Returns

boolean

allowRemove()

allowRemove() : boolean

Returns

boolean

Checks if this fieldset can bind data

allowValueBinding() : boolean
inherited_from \Zend\Form\Fieldset::allowValueBinding()

Returns

boolean

Checks if this fieldset can bind data

allowValueBinding() : boolean
Inherited
inherited_from \Zend\Form\FieldsetInterface::allowValueBinding()

Returns

boolean

Get The class or interface of objects that can be bound to this fieldset.

allowedObjectBindingClass() : string
Inherited

Returns

string

Bind values to the object

bindValues(array $values = array()) : array | mixed | void
inherited_from \Zend\Form\Fieldset::bindValues()

Parameters

$values

array

Returns

arraymixedvoid

Bind values to the bound object

bindValues(array $values = array()) : mixed | void
Inherited
inherited_from \Zend\Form\FieldsetInterface::bindValues()

Parameters

$values

array

Returns

mixedvoid

Clear all attributes

clearAttributes() : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\ElementAttributeRemovalInterface::clearAttributes()

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Clear all label options

clearLabelOptions() : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\LabelAwareInterface::clearLabelOptions()

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Countable: return count of attached elements/fieldsets

count() : integer
Inherited

Returns

integer

createNewObjects()

createNewObjects() : boolean

Returns

boolean

Extract values from the bound object

extract() : array
inherited_from \Zend\Form\Fieldset::extract()

Exceptions

\Zend\Form\Exception\InvalidArgumentException
\Zend\Stdlib\Exception\InvalidArgumentException
\Zend\Form\Exception\DomainException
\Zend\Form\Exception\InvalidElementException

Returns

array

Retrieve a named element or fieldset

get(string $elementOrFieldset) : \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\FieldsetInterface::get()

Parameters

$elementOrFieldset

string

Returns

\Zend\Form\ElementInterface

Retrieve a single element attribute

getAttribute(string $key) : mixed | null
Inherited
inherited_from \Zend\Form\ElementInterface::getAttribute()

Parameters

$key

Returns

mixednull

Retrieve all attributes at once

getAttributes() : array | \Traversable
Inherited
inherited_from \Zend\Form\ElementInterface::getAttributes()

Returns

array\Traversable

Get the initial count of target element

getCount() : integer

Returns

integer

Retrieve all attached elements

getElements() : array | \Traversable
Inherited

Storage is an implementation detail of the concrete class.

inherited_from \Zend\Form\FieldsetInterface::getElements()

Returns

array\Traversable

Retrieve all attached fieldsets

getFieldsets() : array | \Traversable
Inherited

Storage is an implementation detail of the concrete class.

inherited_from \Zend\Form\FieldsetInterface::getFieldsets()

Returns

array\Traversable

Retrieve composed form factory

getFormFactory() : \Zend\Form\Factory
Inherited

Lazy-loads one if none present.

Returns

\Zend\Form\Factory

Get the hydrator used when binding an object to the fieldset

getHydrator() : \Zend\Stdlib\Hydrator\HydratorInterface
Inherited

If no hydrator is present and object implements HydratorAwareInterface, hydrator will be retrieved from the object.

Will lazy-load Hydrator\ArraySerializable if none is present.

inherited_from \Zend\Form\FieldsetInterface::getHydrator()

Returns

\Zend\Stdlib\Hydrator\HydratorInterface

IteratorAggregate: return internal iterator

getIterator() : \Zend\Stdlib\PriorityList
Inherited

Returns

\Zend\Stdlib\PriorityList

Retrieve the label used for this element

getLabel() : null | string
Inherited
inherited_from \Zend\Form\ElementInterface::getLabel()

Returns

nullstring

Get the attributes to use with the label

getLabelAttributes() : array
Inherited
inherited_from \Zend\Form\LabelAwareInterface::getLabelAttributes()

Returns

array

Retrieve a single label option

getLabelOption($key) : mixed | null
Inherited
inherited_from \Zend\Form\LabelAwareInterface::getLabelOption()

Parameters

$key

Returns

mixednull

Get label specific options

getLabelOptions() : array
Inherited
inherited_from \Zend\Form\LabelAwareInterface::getLabelOptions()

Returns

array

Get validation error messages, if any.

getMessages() : array | \Traversable
Inherited

Returns a list of validation failure messages, if any.

inherited_from \Zend\Form\ElementInterface::getMessages()

Returns

array\Traversable

Get value for name

getName() : string | integer
Inherited
inherited_from \Zend\Form\ElementInterface::getName()

Returns

stringinteger

Get the object used by the hydrator

getObject() : mixed
Inherited
inherited_from \Zend\Form\FieldsetInterface::getObject()

Returns

mixed

Return the specified option

getOption(string $option) : NULL | mixed
Inherited
inherited_from \Zend\Form\ElementInterface::getOption()

Parameters

$option

string

Returns

NULLmixed

Get defined options

getOptions() : array
Inherited
inherited_from \Zend\Form\ElementInterface::getOptions()

Returns

array

Get target element

getTargetElement() : \Zend\Form\ElementInterface | null

Returns

\Zend\Form\ElementInterfacenull

Get a template element used for rendering purposes only

getTemplateElement() : null | \Zend\Form\ElementInterface | \Zend\Form\FieldsetInterface

Returns

null\Zend\Form\ElementInterface\Zend\Form\FieldsetInterface

Get the template placeholder

getTemplatePlaceholder() : string

Returns

string

Retrieve the element value

getValue() : mixed
Inherited
inherited_from \Zend\Form\ElementInterface::getValue()

Returns

mixed

Does the fieldset have an element/fieldset by the given name?

has(string $elementOrFieldset) : boolean
Inherited
inherited_from \Zend\Form\FieldsetInterface::has()

Parameters

$elementOrFieldset

string

Returns

boolean

Does the element has a specific attribute ?

hasAttribute(string $key) : boolean
Inherited
inherited_from \Zend\Form\ElementInterface::hasAttribute()

Parameters

$key

string

Returns

boolean

Does the element has a specific label option ?

hasLabelOption(string $key) : boolean
Inherited
inherited_from \Zend\Form\LabelAwareInterface::hasLabelOption()

Parameters

$key

string

Returns

boolean

This function is automatically called when creating element with factory. It allows to perform various operations (add elements.

init() : void
Inherited

..)

inherited_from \Zend\Stdlib\InitializableInterface::init()

Populate values

populateValues(array|\Traversable $data) : void
inherited_from \Zend\Form\Fieldset::populateValues()

Parameters

$data

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException
\Zend\Form\Exception\DomainException

Recursively populate values of attached elements and fieldsets

populateValues(array|\Traversable $data) : void
Inherited
inherited_from \Zend\Form\FieldsetInterface::populateValues()

Parameters

$data

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Prepare the collection by adding a dummy template element if the user want one

prepareElement(\Zend\Form\FormInterface $form) : mixed | void
inherited_from \Zend\Form\Fieldset::prepareElement()

Parameters

$form

\Zend\Form\FormInterface

Returns

mixedvoid

Ensures state is ready for use. Here, we append the name of the fieldsets to every elements in order to avoid name clashes if the same fieldset is used multiple times

prepareElement(\Zend\Form\FormInterface $form) : mixed | void
Inherited

Parameters

$form

\Zend\Form\FormInterface

Returns

mixedvoid

Remove a named element or fieldset

remove(string $elementOrFieldset) : \Zend\Form\FieldsetInterface
Inherited
inherited_from \Zend\Form\FieldsetInterface::remove()

Parameters

$elementOrFieldset

string

Returns

\Zend\Form\FieldsetInterface

Remove a single attribute

removeAttribute(string $key) : \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\ElementAttributeRemovalInterface::removeAttribute()

Parameters

$key

string

Returns

\Zend\Form\ElementInterface

Remove many attributes at once

removeAttributes(array $keys) : \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\ElementAttributeRemovalInterface::removeAttributes()

Parameters

$keys

array

Returns

\Zend\Form\ElementInterface

Remove a single label option

removeLabelOption(string $key) : \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\LabelAwareInterface::removeLabelOption()

Parameters

$key

string

Returns

\Zend\Form\ElementInterface

Remove many attributes at once

removeLabelOptions(array $keys) : \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\LabelAwareInterface::removeLabelOptions()

Parameters

$keys

array

Returns

\Zend\Form\ElementInterface

Get allow add

setAllowAdd(boolean $allowAdd) : \Zend\Form\Element\Collection

Parameters

$allowAdd

boolean

Returns

\Zend\Form\Element\Collection

setAllowRemove()

setAllowRemove(boolean $allowRemove) : \Zend\Form\Element\Collection

Parameters

$allowRemove

boolean

Returns

\Zend\Form\Element\Collection

Set the class or interface of objects that can be bound to this fieldset.

setAllowedObjectBindingClass(string $allowObjectBindingClass) 
Inherited

Parameters

$allowObjectBindingClass

string

Set a single element attribute

setAttribute(string $key, mixed $value) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\ElementInterface::setAttribute()

Parameters

$key

string

$value

mixed

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set many attributes at once

setAttributes(array|\Traversable $arrayOrTraversable) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited

Implementation will decide if this will overwrite or merge.

inherited_from \Zend\Form\ElementInterface::setAttributes()

Parameters

$arrayOrTraversable

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set the initial count of target element

setCount($count) : \Zend\Form\Element\Collection

Parameters

$count

Returns

\Zend\Form\Element\Collection

setCreateNewObjects()

setCreateNewObjects(boolean $createNewObjects) : \Zend\Form\Element\Collection

Parameters

$createNewObjects

boolean

Returns

\Zend\Form\Element\Collection

Compose a form factory to use when calling add() with a non-element/fieldset

setFormFactory(\Zend\Form\Factory $factory) : \Zend\Form\Form
Inherited

Parameters

$factory

\Zend\Form\Factory

Returns

\Zend\Form\Form

Set the hydrator to use when binding an object to the element

setHydrator(\Zend\Stdlib\Hydrator\HydratorInterface $hydrator) : \Zend\Form\FieldsetInterface
Inherited
inherited_from \Zend\Form\FieldsetInterface::setHydrator()

Parameters

$hydrator

\Zend\Stdlib\Hydrator\HydratorInterface

Returns

\Zend\Form\FieldsetInterface

Set the label used for this element

setLabel($label) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\ElementInterface::setLabel()

Parameters

$label

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set the attributes to use with the label

setLabelAttributes(array $labelAttributes) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\LabelAwareInterface::setLabelAttributes()

Parameters

$labelAttributes

array

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set a single label optionn

setLabelOption(string $key, mixed $value) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\LabelAwareInterface::setLabelOption()

Parameters

$key

string

$value

mixed

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set many label options at once

setLabelOptions(array|\Traversable $arrayOrTraversable) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited

Implementation will decide if this will overwrite or merge.

inherited_from \Zend\Form\LabelAwareInterface::setLabelOptions()

Parameters

$arrayOrTraversable

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set a list of messages to report when validation fails

setMessages(array|\Traversable $messages) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\ElementInterface::setMessages()

Parameters

$messages

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set value for name

setName(string $name) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited

In most cases, this will proxy to the attributes for storage, but is present to indicate that elements are generally named.

inherited_from \Zend\Form\ElementInterface::setName()

Parameters

$name

string

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set the object used by the hydrator In this case the "object" is a collection of objects

setObject(array|\Traversable $object) : \Zend\Form\Fieldset | \Zend\Form\FieldsetInterface
inherited_from \Zend\Form\Fieldset::setObject()

Parameters

$object

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\Fieldset\Zend\Form\FieldsetInterface

Set the object used by the hydrator

setObject(object $object) : \Zend\Form\Fieldset | \Zend\Form\FieldsetInterface
Inherited
inherited_from \Zend\Form\FieldsetInterface::setObject()

Parameters

$object

object

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\Fieldset\Zend\Form\FieldsetInterface

Set a single option for an element

setOption(string $key, mixed $value) : \Zend\Form\Element\Collection
Inherited
inherited_from \Zend\Form\ElementInterface::setOption()
fluent This method is part of a fluent interface and will return the same instance

Parameters

$key

string

$value

mixed

Returns

\Zend\Form\Element\Collection

Accepted options for Collection: - target_element: an array or element used in the collection - count: number of times the element is added initially - allow_add: if set to true, elements can be added to the form dynamically (using JavaScript) - allow_remove: if set to true, elements can be removed to the form - should_create_template: if set to true, a template is generated (inside a <span>) - template_placeholder: placeholder used in the data template

setOptions(array|\Traversable $options) : \Zend\Form\Element\Collection
inherited_from \Zend\Form\Fieldset::setOptions()

Parameters

$options

array\Traversable

Returns

\Zend\Form\Element\Collection

Set options for an element. Accepted options are: - label: label to associate with the element - label_attributes: attributes to use when the label is rendered - label_options: label specific options

setOptions(array|\Traversable $options) : \Zend\Form\Element | \Zend\Form\ElementInterface
Inherited
inherited_from \Zend\Form\ElementInterface::setOptions()

Parameters

$options

array\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\Element\Zend\Form\ElementInterface

Set/change the priority of an element or fieldset

setPriority(string $elementOrFieldset, integer $priority) : \Zend\Form\FieldsetInterface
Inherited
inherited_from \Zend\Form\FieldsetInterface::setPriority()

Parameters

$elementOrFieldset

string

$priority

integer

Returns

\Zend\Form\FieldsetInterface

If set to true, a template prototype is automatically added to the form to ease the creation of dynamic elements through JavaScript

setShouldCreateTemplate(boolean $shouldCreateTemplate) : \Zend\Form\Element\Collection

Parameters

$shouldCreateTemplate

boolean

Returns

\Zend\Form\Element\Collection

Set the target element

setTargetElement(\Zend\Form\ElementInterface|array|\Traversable $elementOrFieldset) : \Zend\Form\Element\Collection

Parameters

$elementOrFieldset

\Zend\Form\ElementInterfacearray\Traversable

Exceptions

\Zend\Form\Exception\InvalidArgumentException

Returns

\Zend\Form\Element\Collection

Set the placeholder used in the template generated to help create new elements in JavaScript

setTemplatePlaceholder(string $templatePlaceholder) : \Zend\Form\Element\Collection

Parameters

$templatePlaceholder

string

Returns

\Zend\Form\Element\Collection

Set if this fieldset is used as a base fieldset

setUseAsBaseFieldset(boolean $useAsBaseFieldset) : \Zend\Form\Fieldset
Inherited

Parameters

$useAsBaseFieldset

boolean

Returns

\Zend\Form\Fieldset

Set the element value

setValue(mixed $value) : \Zend\Form\Element
Inherited
inherited_from \Zend\Form\ElementInterface::setValue()

Parameters

$value

mixed

Returns

\Zend\Form\Element

Get if the collection should create a template

shouldCreateTemplate() : boolean

Returns

boolean

Is this fieldset use as a base fieldset for a form ?

useAsBaseFieldset() : boolean
Inherited

Returns

boolean

Add a new instance of the target element

addNewTargetElementInstance(string $name) : \Zend\Form\ElementInterface

Parameters

$name

string

Exceptions

\Zend\Form\Exception\DomainException

Returns

\Zend\Form\ElementInterface

Create a new instance of the target element

createNewTargetElementInstance() : \Zend\Form\ElementInterface

Returns

\Zend\Form\ElementInterface

Create a dummy template element

createTemplateElement() : null | \Zend\Form\ElementInterface | \Zend\Form\FieldsetInterface

Returns

null\Zend\Form\ElementInterface\Zend\Form\FieldsetInterface

Extract values from the bound object

extract() : array
Inherited

Returns

array

Replaces the default template object of a sub element with the corresponding real entity so that all properties are preserved.

replaceTemplateObjects() : void

 Properties

 

Are new elements allowed to be added dynamically ?

$allowAdd : boolean

Default

true
 

Are existing elements allowed to be removed dynamically ?

$allowRemove : boolean

Default

true
 

The class or interface of objects that can be bound to this fieldset.

$allowedObjectBindingClass : string

Default

 

$attributes

$attributes : array

Default

array()
 

Initial count of target element

$count : integer

Default

1
 

Whether or not to create new objects during modify

$createNewObjects : boolean

Default

false
 

$elements

$elements : array

Default

array()
 

$factory

$factory : \Zend\Form\Factory

Default

 

$fieldsets

$fieldsets : array

Default

array()
 

Hydrator to use with bound object

$hydrator : \Zend\Stdlib\Hydrator\HydratorInterface

Default

 

$iterator

$iterator : \Zend\Stdlib\PriorityList

Default

 

$label

$label : null | string

Default

 

$labelAttributes

$labelAttributes : array

Default

array()
 

Label specific options

$labelOptions : array

Default

array()
 

The index of the last child element or fieldset

$lastChildIndex : integer

Default

-1
 

Validation error messages

$messages : array

Default

array()
 

The object bound to this fieldset, if any

$object : null | object

Default

 

custom options

$options : array

Default

array()
 

Should child elements must be created on self::prepareElement()?

$shouldCreateChildrenOnPrepareElement : boolean

Default

true
 

Is the template generated ?

$shouldCreateTemplate : boolean

Default

false
 

Element used in the collection

$targetElement : \Zend\Form\ElementInterface

Default

 

Element used as a template

$templateElement : \Zend\Form\ElementInterface | \Zend\Form\FieldsetInterface

Default

 

Placeholder used in template content for making your life easier with JavaScript

$templatePlaceholder : string

Default

self::DEFAULT_TEMPLATE_PLACEHOLDER
 

Should this fieldset be used as a base fieldset in the parent form ?

$useAsBaseFieldset : boolean

Default

false
 

$value

$value : mixed

Default

 Constants

 

Default template placeholder

DEFAULT_TEMPLATE_PLACEHOLDER = '__index__'