FormElementInterface extends RenderableInterface

A base form element interface, which can be the starting point for creating custom (PHP-based) Form Elements.

A FormElement is a part of a Page, which in turn is part of a FormDefinition. See for an in-depth explanation.

Often, you should rather subclass instead of implementing this interface.

Scope: frontend

Table of Contents

Methods

addValidator()  : mixed
Registers a validator for this element
getDefaultValue()  : mixed
Get the default value with which the Form Element should be initialized during display.
getIdentifier()  : string
The identifier of this renderable
getIndex()  : int
Get the index inside the parent renderable
getLabel()  : string
Get the label which shall be displayed next to the form element
getParentRenderable()  : CompositeRenderableInterface|null
Return the parent renderable
getProperties()  : array<string|int, mixed>
Get all element-specific configuration properties
getRendererClassName()  : string
Get the renderer class name to be used to display this form; must implement RendererInterface
getRenderingOptions()  : array<string|int, mixed>
Get all rendering options
getTemplateName()  : string
Get the template name of the renderable
getType()  : string
Abstract "type" of this Renderable. Is used during the rendering process to determine the template file or the View PHP class being used to render the particular element.
getUniqueIdentifier()  : string
Returns a unique identifier of this element.
getValidators()  : SplObjectStorage<string|int, ValidatorInterface>
Returns the child validators of the ConjunctionValidator that is registered for this element
initializeFormElement()  : mixed
Will be called as soon as the element is (tried to be) added to a form
isEnabled()  : bool
Returns whether this renderable is enabled
isRequired()  : bool
Whether or not this element is required
onRemoveFromParentRenderable()  : mixed
This function is called after a renderable has been removed from its parent renderable. The function should make sure to clean up the internal state, like resetting $this->parentRenderable or deregistering the renderable of the form.
registerInFormIfPossible()  : mixed
Register this element at the parent form, if there is a connection to the parent form.
setDataType()  : mixed
Set the target data type for this element
setDefaultValue()  : mixed
Set the default value with which the Form Element should be initialized during display.
setIndex()  : mixed
Set the index of this renderable inside the parent renderable
setParentRenderable()  : mixed
Set the new parent renderable. You should not call this directly; it is automatically called by addRenderable.
setProperty()  : mixed
Set an element-specific configuration property.
setRenderingOption()  : mixed
Set a rendering option

Methods

getDefaultValue()

Get the default value with which the Form Element should be initialized during display.

public getDefaultValue() : mixed
Return values
mixed

the default value for this Form Element

getIdentifier()

The identifier of this renderable

public getIdentifier() : string
Return values
string

getIndex()

Get the index inside the parent renderable

public getIndex() : int
Return values
int

getLabel()

Get the label which shall be displayed next to the form element

public getLabel() : string
Return values
string

getProperties()

Get all element-specific configuration properties

public getProperties() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRendererClassName()

Get the renderer class name to be used to display this form; must implement RendererInterface

public getRendererClassName() : string
Return values
string

the renderer class name

getRenderingOptions()

Get all rendering options

public getRenderingOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

associative array of rendering options

getTemplateName()

Get the template name of the renderable

public getTemplateName() : string
Return values
string

getType()

Abstract "type" of this Renderable. Is used during the rendering process to determine the template file or the View PHP class being used to render the particular element.

public getType() : string
Return values
string

getUniqueIdentifier()

Returns a unique identifier of this element.

public getUniqueIdentifier() : string

While element identifiers are only unique within one form, this includes the identifier of the form itself, making it "globally" unique

Return values
string

the "globally" unique identifier of this element

getValidators()

Returns the child validators of the ConjunctionValidator that is registered for this element

public getValidators() : SplObjectStorage<string|int, ValidatorInterface>
Internal
Return values
SplObjectStorage<string|int, ValidatorInterface>

initializeFormElement()

Will be called as soon as the element is (tried to be) added to a form

public initializeFormElement() : mixed
Internal
Tags
see
registerInFormIfPossible()

isEnabled()

Returns whether this renderable is enabled

public isEnabled() : bool
Return values
bool

isRequired()

Whether or not this element is required

public isRequired() : bool
Return values
bool

onRemoveFromParentRenderable()

This function is called after a renderable has been removed from its parent renderable. The function should make sure to clean up the internal state, like resetting $this->parentRenderable or deregistering the renderable of the form.

public onRemoveFromParentRenderable() : mixed
Internal

registerInFormIfPossible()

Register this element at the parent form, if there is a connection to the parent form.

public registerInFormIfPossible() : mixed
Internal

setDataType()

Set the target data type for this element

public setDataType(string $dataType) : mixed
Parameters
$dataType : string

the target data type

setDefaultValue()

Set the default value with which the Form Element should be initialized during display.

public setDefaultValue(mixed $defaultValue) : mixed
Parameters
$defaultValue : mixed

the default value for this Form Element

setIndex()

Set the index of this renderable inside the parent renderable

public setIndex(int $index) : mixed
Parameters
$index : int
Internal

setParentRenderable()

Set the new parent renderable. You should not call this directly; it is automatically called by addRenderable.

public setParentRenderable(CompositeRenderableInterface $renderable) : mixed

This method should also register itself at the parent form, if possible.

Parameters
$renderable : CompositeRenderableInterface
Internal

setProperty()

Set an element-specific configuration property.

public setProperty(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed

setRenderingOption()

Set a rendering option

public setRenderingOption(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed

        
On this page

Search results