Class Collection

Summary

Fully Qualified Name: Laminas\Form\Element\Collection
Extends: Fieldset

Description

Methods

Name Description Defined By
__clone() Make a deep clone of a fieldset Fieldset
__construct() Fieldset
add() Add an element or fieldset Fieldset
allowAdd() Get allow add Collection
allowObjectBinding() Checks if the object can be set in this fieldset Collection
allowRemove() Collection
allowValueBinding() Checks if this fieldset can bind data Collection
allowedObjectBindingClass() Get The class or interface of objects that can be bound to this fieldset. Fieldset
bindValues() Bind values to the object Collection
clearAttributes() Clear all attributes Element
clearLabelOptions() Clear all label options Element
count() Countable: return count of attached elements/fieldsets Fieldset
createNewObjects() Collection
extract() Collection
get() Retrieve a named element or fieldset Fieldset
getAttribute() Retrieve a single element attribute Element
getAttributes() Retrieve all attributes at once Element
getCount() Get the initial count of target element Collection
getElements() Retrieve all attached elements Fieldset
getFieldsets() Retrieve all attached fieldsets Fieldset
getFormFactory() Retrieve composed form factory Fieldset
getHydrator() Get the hydrator used when binding an object to the fieldset Fieldset
getIterator() IteratorAggregate: return internal iterator Fieldset
getLabel() Retrieve the label used for this element Element
getLabelAttributes() Get the attributes to use with the label Element
getLabelOption() Retrieve a single label option Element
getLabelOptions() Get label specific options Element
getMessages() Get validation error messages, if any Fieldset
getName() Get value for name Element
getObject() Get the object used by the hydrator Fieldset
getOption() Return the specified option Element
getOptions() Get defined options Element
getTargetElement() Get target element Collection
getTemplateElement() Get a template element used for rendering purposes only Collection
getTemplatePlaceholder() Get the template placeholder Collection
getValue() Retrieve the element value Element
has() Does the fieldset have an element/fieldset by the given name? Fieldset
hasAttribute() Does the element has a specific attribute ? Element
hasLabelOption() Does the element has a specific label option ? Element
init() This function is automatically called when creating element with factory. It allows to perform various operations (add elements. Element
populateValues() Populate values Collection
prepareElement() Prepare the collection by adding a dummy template element if the user want one Collection
remove() Remove a named element or fieldset Fieldset
removeAttribute() Remove a single attribute Element
removeAttributes() Remove many attributes at once Element
removeLabelOption() Remove a single label option Element
removeLabelOptions() Remove many attributes at once Element
setAllowAdd() Get allow add Collection
setAllowRemove() Collection
setAllowedObjectBindingClass() Set the class or interface of objects that can be bound to this fieldset. Fieldset
setAttribute() Set a single element attribute Element
setAttributes() Set many attributes at once Element
setCount() Set the initial count of target element Collection
setCreateNewObjects() Collection
setFormFactory() Compose a form factory to use when calling add() with a non-element/fieldset Fieldset
setHydrator() Set the hydrator to use when binding an object to the element Fieldset
setLabel() Set the label used for this element Element
setLabelAttributes() Set the attributes to use with the label Element
setLabelOption() Set a single label optionn Element
setLabelOptions() Set many label options at once Element
setMessages() Set a hash of element names/messages to use when validation fails Fieldset
setName() Set value for name Element
setObject() Set the object used by the hydrator In this case the "object" is a collection of objects Collection
setOption() Set a single option for an element Element
setOptions() 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 ) - template_placeholder: placeholder used in the data template Collection
setPriority() Set/change the priority of an element or fieldset Fieldset
setShouldCreateTemplate() If set to true, a template prototype is automatically added to the form to ease the creation of dynamic elements through JavaScript Collection
setTargetElement() Set the target element Collection
setTemplatePlaceholder() Set the placeholder used in the template generated to help create new elements in JavaScript Collection
setUseAsBaseFieldset() Set if this fieldset is used as a base fieldset Fieldset
setValue() Set the element value Element
shouldCreateTemplate() Get if the collection should create a template Collection
useAsBaseFieldset() Is this fieldset use as a base fieldset for a form ? Fieldset

Method Details

__clone()

Make a deep clone of a fieldset

Returns: void

__construct()

Parameter Name Type Description
$name null|int|string Optional
$options array Optional

Returns:

add()

Add an element or fieldset

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

Parameter Name Type Description
$elementOrFieldset array|\Traversable|\ElementInterface
$flags array

Returns: $this

allowAdd()

Get allow add

Returns: bool

allowObjectBinding()

Checks if the object can be set in this fieldset

Parameter Name Type Description
$object object

Returns: bool

allowRemove()

Returns: bool

allowValueBinding()

Checks if this fieldset can bind data

Returns: bool

allowedObjectBindingClass()

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

Returns: string

bindValues()

Bind values to the object

Parameter Name Type Description
$values array
$validationGroup array

Returns: array|mixed|void

clearAttributes()

Clear all attributes

Returns: $this

clearLabelOptions()

Clear all label options

Returns: $this

count()

Countable: return count of attached elements/fieldsets

Returns: int

createNewObjects()

Returns: bool

extract()

Returns: array

get()

Retrieve a named element or fieldset

Parameter Name Type Description
$elementOrFieldset string

Returns: \ElementInterface|\FieldsetInterface

getAttribute()

Retrieve a single element attribute

Parameter Name Type Description
$key
$key

Returns: mixed|null

getAttributes()

Retrieve all attributes at once

Returns: array|\Traversable

getCount()

Get the initial count of target element

Returns: int

getElements()

Retrieve all attached elements

Storage is an implementation detail of the concrete class.

Returns: array|\Traversable

getFieldsets()

Retrieve all attached fieldsets

Storage is an implementation detail of the concrete class.

Returns: array|\Traversable

getFormFactory()

Retrieve composed form factory

Lazy-loads one if none present.

Returns: \Factory

getHydrator()

Get the hydrator used when binding an object to the fieldset

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.

Returns: \HydratorInterface

getIterator()

IteratorAggregate: return internal iterator

Returns: \PriorityList

getLabel()

Retrieve the label used for this element

Returns: null|string

getLabelAttributes()

Get the attributes to use with the label

Returns: array

getLabelOption()

Retrieve a single label option

Parameter Name Type Description
$key
$key

Returns: mixed|null

getLabelOptions()

Get label specific options

Returns: array

getMessages()

Get validation error messages, if any

Returns a hash of element names/messages for all elements failing validation, or, if $elementName is provided, messages for that element only.

Parameter Name Type Description
$elementName null|string

Returns: array|\Traversable

getName()

Get value for name

Returns: string|int

getObject()

Get the object used by the hydrator

Returns: mixed

getOption()

Return the specified option

Parameter Name Type Description
$option string

Returns: null|mixed

getOptions()

Get defined options

Returns: array

getTargetElement()

Get target element

Returns: \ElementInterface|null

getTemplateElement()

Get a template element used for rendering purposes only

Returns: null|\ElementInterface|\FieldsetInterface

getTemplatePlaceholder()

Get the template placeholder

Returns: string

getValue()

Retrieve the element value

Returns: mixed

has()

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

Parameter Name Type Description
$elementOrFieldset string

Returns: bool

hasAttribute()

Does the element has a specific attribute ?

Parameter Name Type Description
$key string

Returns: bool

hasLabelOption()

Does the element has a specific label option ?

Parameter Name Type Description
$key string

Returns: bool

init()

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

..)

Returns: void

populateValues()

Populate values

Parameter Name Type Description
$data array|\Traversable

Returns: void

prepareElement()

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

Parameter Name Type Description
$form \FormInterface

Returns: mixed|void

remove()

Remove a named element or fieldset

Parameter Name Type Description
$elementOrFieldset string

Returns: $this

removeAttribute()

Remove a single attribute

Parameter Name Type Description
$key string

Returns: $this

removeAttributes()

Remove many attributes at once

Parameter Name Type Description
$keys array

Returns: $this

removeLabelOption()

Remove a single label option

Parameter Name Type Description
$key string

Returns: $this

removeLabelOptions()

Remove many attributes at once

Parameter Name Type Description
$keys array

Returns: $this

setAllowAdd()

Get allow add

Parameter Name Type Description
$allowAdd bool

Returns: $this

setAllowRemove()

Parameter Name Type Description
$allowRemove bool

Returns: $this

setAllowedObjectBindingClass()

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

Parameter Name Type Description
$allowObjectBindingClass string

Returns:

setAttribute()

Set a single element attribute

Parameter Name Type Description
$key string
$value mixed

Returns: $this

setAttributes()

Set many attributes at once

Implementation will decide if this will overwrite or merge.

Parameter Name Type Description
$arrayOrTraversable array|\Traversable

Returns: $this

setCount()

Set the initial count of target element

Parameter Name Type Description
$count
$count

Returns: $this

setCreateNewObjects()

Parameter Name Type Description
$createNewObjects bool

Returns: $this

setFormFactory()

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

Parameter Name Type Description
$factory \Factory

Returns: $this

setHydrator()

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

Parameter Name Type Description
$hydrator \HydratorInterface

Returns: $this

setLabel()

Set the label used for this element

Parameter Name Type Description
$label
$label

Returns: $this

setLabelAttributes()

Set the attributes to use with the label

Parameter Name Type Description
$labelAttributes array

Returns: $this

setLabelOption()

Set a single label optionn

Parameter Name Type Description
$key string
$value mixed

Returns: $this

setLabelOptions()

Set many label options at once

Implementation will decide if this will overwrite or merge.

Parameter Name Type Description
$arrayOrTraversable array|\Traversable

Returns: $this

setMessages()

Set a hash of element names/messages to use when validation fails

Parameter Name Type Description
$messages array|\Traversable

Returns: $this

setName()

Set value for name

Parameter Name Type Description
$name string

Returns: $this

setObject()

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

Parameter Name Type Description
$object array|\Traversable

Returns: \Fieldset|\FieldsetInterface

setOption()

Set a single option for an element

Parameter Name Type Description
$key string
$value mixed

Returns: $this

setOptions()

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 ) - template_placeholder: placeholder used in the data template

Parameter Name Type Description
$options array|\Traversable

Returns: $this

setPriority()

Set/change the priority of an element or fieldset

Parameter Name Type Description
$elementOrFieldset string
$priority int

Returns: $this

setShouldCreateTemplate()

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

Parameter Name Type Description
$shouldCreateTemplate bool

Returns: $this

setTargetElement()

Set the target element

Parameter Name Type Description
$elementOrFieldset \ElementInterface|array|\Traversable

Returns: $this

setTemplatePlaceholder()

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

Parameter Name Type Description
$templatePlaceholder string

Returns: $this

setUseAsBaseFieldset()

Set if this fieldset is used as a base fieldset

Parameter Name Type Description
$useAsBaseFieldset bool

Returns: $this

setValue()

Set the element value

Parameter Name Type Description
$value mixed

Returns: $this

shouldCreateTemplate()

Get if the collection should create a template

Returns: bool

useAsBaseFieldset()

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

Returns: bool

Top