Page extends AbstractSection
A Page, being part of a bigger FormDefinition. It contains numerous FormElements as children.
A FormDefinition consists of multiple Pages, where only one page is visible at any given time.
Most of the API of this object is implemented in , so make sure to review this class as well.
Please see for an in-depth explanation.
Scope: frontend This class is NOT meant to be sub classed by developers.
Table of Contents
Properties
- $identifier : string
- The identifier of this renderable
- $index : int
- The position of this renderable inside the parent renderable.
- $label : string
- The label of this renderable
- $parentRenderable : CompositeRenderableInterface|null
- The parent renderable
- $renderables : array<string|int, RenderableInterface>
- array of child renderables
- $renderingOptions : array<string|int, mixed>
- associative array of rendering options
- $request : ServerRequestInterface|null
- $templateName : string
- The name of the template file of the renderable.
- $type : 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.
- $validatorResolver : ValidatorResolver|null
- $variants : array<string|int, mixed>
- associative array of rendering variants
Methods
- __construct() : mixed
- Constructor. Needs this Page's identifier
- addElement() : mixed
- Add a new form element at the end of the section
- addValidator() : mixed
- Add a validator to the element.
- addVariant() : mixed
- Adds the specified variant to this form element
- applyVariant() : mixed
- Apply the specified variant to this form element regardless of their conditions
- createElement() : FormElementInterface
- Create a form element with the given $identifier and attach it to this section/page.
- createValidator() : ValidatorInterface|null
- Create a validator for the element.
- createVariant() : RenderableVariantInterface
- getElements() : array<string|int, FormElementInterface>
- Get the child Form Elements
- getElementsRecursively() : array<string|int, FormElementInterface>
- Get the child Form Elements
- getIdentifier() : string
- Get the identifier of the element
- getIndex() : int
- Get the index of the renderable
- getLabel() : string
- Get the label of the renderable
- getParentRenderable() : CompositeRenderableInterface|null
- Get the parent renderable
- getRenderablesRecursively() : array<string|int, RenderableInterface>
- Returns all RenderableInterface instances of this composite renderable recursively
- getRendererClassName() : string
- Get the classname of the renderer
- getRenderingOptions() : array<string|int, mixed>
- Get all rendering options
- getRequest() : ServerRequestInterface|null
- getRootForm() : FormDefinition
- Get the root form this element belongs to
- getTemplateName() : string
- Get the templateName name of the renderable
- getType() : string
- Get the type of the renderable
- getValidators() : SplObjectStorage
- Get all validators on the element
- getVariants() : array<string|int, RenderableVariantInterface>
- Get all rendering variants
- isEnabled() : bool
- Returns whether this renderable is enabled
- moveElementAfter() : mixed
- Move FormElement $element after $referenceElement
- moveElementBefore() : mixed
- Move FormElement $element before $referenceElement.
- onRemoveFromParentRenderable() : mixed
- This function is called after a renderable has been removed from its parent renderable.
- registerInFormIfPossible() : mixed
- Register this element at the parent form, if there is a connection to the parent form.
- removeElement() : mixed
- Remove $elementToRemove from this Section/Page
- setDataType() : mixed
- Set the datatype
- setIdentifier() : mixed
- Set the identifier of the element
- setIndex() : mixed
- Set the index of the renderable
- setLabel() : mixed
- Set the label which shall be displayed next to the form element
- setOptions() : mixed
- Set multiple properties of this object at once.
- setParentRenderable() : mixed
- Set the parent renderable
- setRenderingOption() : mixed
- Set the rendering option $key to $value.
- setRequest() : void
- addRenderable() : mixed
- Add a renderable to the list of child renderables.
- moveRenderableAfter() : mixed
- Move $renderableToMove after $referenceRenderable
- moveRenderableBefore() : mixed
- Move $renderableToMove before $referenceRenderable
- removeRenderable() : mixed
- Remove a renderable from this renderable.
Properties
$identifier
The identifier of this renderable
protected
string
$identifier
$index
The position of this renderable inside the parent renderable.
protected
int
$index
= 0
$label
The label of this renderable
protected
string
$label
= ''
$parentRenderable
The parent renderable
protected
CompositeRenderableInterface|null
$parentRenderable
$renderables
array of child renderables
protected
array<string|int, RenderableInterface>
$renderables
= []
$renderingOptions
associative array of rendering options
protected
array<string|int, mixed>
$renderingOptions
= []
$request
protected
ServerRequestInterface|null
$request
= null
$templateName
The name of the template file of the renderable.
protected
string
$templateName
= ''
$type
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.
protected
string
$type
$validatorResolver
protected
ValidatorResolver|null
$validatorResolver
= null
$variants
associative array of rendering variants
protected
array<string|int, mixed>
$variants
= []
Methods
__construct()
Constructor. Needs this Page's identifier
public
__construct(string $identifier[, string $type = 'Page' ]) : mixed
Parameters
- $identifier : string
-
The Page's identifier
- $type : string = 'Page'
-
The Page's type
Tags
addElement()
Add a new form element at the end of the section
public
addElement(FormElementInterface $formElement) : mixed
Parameters
- $formElement : FormElementInterface
-
The form element to add
Tags
addValidator()
Add a validator to the element.
public
addValidator(ValidatorInterface $validator) : mixed
Parameters
- $validator : ValidatorInterface
addVariant()
Adds the specified variant to this form element
public
addVariant(RenderableVariantInterface $variant) : mixed
Parameters
- $variant : RenderableVariantInterface
applyVariant()
Apply the specified variant to this form element regardless of their conditions
public
applyVariant(RenderableVariantInterface $variant) : mixed
Parameters
- $variant : RenderableVariantInterface
createElement()
Create a form element with the given $identifier and attach it to this section/page.
public
createElement(string $identifier, string $typeName) : FormElementInterface
- Create Form Element object based on the given $typeName
- set defaults inside the Form Element (based on the parent form's field defaults)
- attach Form Element to this Section/Page
- return the newly created Form Element object
Parameters
- $identifier : string
-
Identifier of the new form element
- $typeName : string
-
type of the new form element
Tags
Return values
FormElementInterface —the newly created form element
createValidator()
Create a validator for the element.
public
createValidator(string $validatorIdentifier[, array<string|int, mixed> $options = [] ]) : ValidatorInterface|null
Parameters
- $validatorIdentifier : string
- $options : array<string|int, mixed> = []
Tags
Return values
ValidatorInterface|nullcreateVariant()
public
createVariant(array<string|int, mixed> $options) : RenderableVariantInterface
Parameters
- $options : array<string|int, mixed>
Return values
RenderableVariantInterfacegetElements()
Get the child Form Elements
public
getElements() : array<string|int, FormElementInterface>
Return values
array<string|int, FormElementInterface> —The Page's elements
getElementsRecursively()
Get the child Form Elements
public
getElementsRecursively() : array<string|int, FormElementInterface>
Return values
array<string|int, FormElementInterface> —The Page's elements
getIdentifier()
Get the identifier of the element
public
getIdentifier() : string
Return values
stringgetIndex()
Get the index of the renderable
public
getIndex() : int
Return values
intgetLabel()
Get the label of the renderable
public
getLabel() : string
Return values
stringgetParentRenderable()
Get the parent renderable
public
getParentRenderable() : CompositeRenderableInterface|null
Return values
CompositeRenderableInterface|nullgetRenderablesRecursively()
Returns all RenderableInterface instances of this composite renderable recursively
public
getRenderablesRecursively() : array<string|int, RenderableInterface>
Return values
array<string|int, RenderableInterface>getRendererClassName()
Get the classname of the renderer
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
getRequest()
public
getRequest() : ServerRequestInterface|null
Return values
ServerRequestInterface|nullgetRootForm()
Get the root form this element belongs to
public
getRootForm() : FormDefinition
Tags
Return values
FormDefinitiongetTemplateName()
Get the templateName name of the renderable
public
getTemplateName() : string
Return values
stringgetType()
Get the type of the renderable
public
getType() : string
Return values
stringgetValidators()
Get all validators on the element
public
getValidators() : SplObjectStorage
Return values
SplObjectStoragegetVariants()
Get all rendering variants
public
getVariants() : array<string|int, RenderableVariantInterface>
Return values
array<string|int, RenderableVariantInterface>isEnabled()
Returns whether this renderable is enabled
public
isEnabled() : bool
Return values
boolmoveElementAfter()
Move FormElement $element after $referenceElement
public
moveElementAfter(FormElementInterface $elementToMove, FormElementInterface $referenceElement) : mixed
Both $element and $referenceElement must be direct descendants of this Section/Page.
Parameters
- $elementToMove : FormElementInterface
- $referenceElement : FormElementInterface
moveElementBefore()
Move FormElement $element before $referenceElement.
public
moveElementBefore(FormElementInterface $elementToMove, FormElementInterface $referenceElement) : mixed
Both $element and $referenceElement must be direct descendants of this Section/Page.
Parameters
- $elementToMove : FormElementInterface
- $referenceElement : FormElementInterface
onRemoveFromParentRenderable()
This function is called after a renderable has been removed from its parent renderable.
public
onRemoveFromParentRenderable() : mixed
This just passes the event down to all child renderables of this composite renderable.
registerInFormIfPossible()
Register this element at the parent form, if there is a connection to the parent form.
public
registerInFormIfPossible() : mixed
removeElement()
Remove $elementToRemove from this Section/Page
public
removeElement(FormElementInterface $elementToRemove) : mixed
Parameters
- $elementToRemove : FormElementInterface
setDataType()
Set the datatype
public
setDataType(string $dataType) : mixed
Parameters
- $dataType : string
setIdentifier()
Set the identifier of the element
public
setIdentifier(string $identifier) : mixed
Parameters
- $identifier : string
setIndex()
Set the index of the renderable
public
setIndex(int $index) : mixed
Parameters
- $index : int
setLabel()
Set the label which shall be displayed next to the form element
public
setLabel(string $label) : mixed
Parameters
- $label : string
setOptions()
Set multiple properties of this object at once.
public
setOptions(array<string|int, mixed> $options[, bool $resetValidators = false ]) : mixed
Every property which has a corresponding set* method can be set using the passed $options array.
Parameters
- $options : array<string|int, mixed>
- $resetValidators : bool = false
setParentRenderable()
Set the parent renderable
public
setParentRenderable(CompositeRenderableInterface $parentRenderable) : mixed
Parameters
- $parentRenderable : CompositeRenderableInterface
Tags
setRenderingOption()
Set the rendering option $key to $value.
public
setRenderingOption(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
setRequest()
public
setRequest(ServerRequestInterface|null $request) : void
Parameters
- $request : ServerRequestInterface|null
addRenderable()
Add a renderable to the list of child renderables.
protected
addRenderable(RenderableInterface $renderable) : mixed
This function will be wrapped by the subclasses, f.e. with an "addPage" or "addElement" method with the correct type hint.
Parameters
- $renderable : RenderableInterface
Tags
moveRenderableAfter()
Move $renderableToMove after $referenceRenderable
protected
moveRenderableAfter(RenderableInterface $renderableToMove, RenderableInterface $referenceRenderable) : mixed
This function will be wrapped by the subclasses, f.e. with an "movePageAfter" or "moveElementAfter" method with the correct type hint.
Parameters
- $renderableToMove : RenderableInterface
- $referenceRenderable : RenderableInterface
Tags
moveRenderableBefore()
Move $renderableToMove before $referenceRenderable
protected
moveRenderableBefore(RenderableInterface $renderableToMove, RenderableInterface $referenceRenderable) : mixed
This function will be wrapped by the subclasses, f.e. with an "movePageBefore" or "moveElementBefore" method with the correct type hint.
Parameters
- $renderableToMove : RenderableInterface
- $referenceRenderable : RenderableInterface
Tags
removeRenderable()
Remove a renderable from this renderable.
protected
removeRenderable(RenderableInterface $renderableToRemove) : mixed
This function will be wrapped by the subclasses, f.e. with an "removePage" or "removeElement" method with the correct type hint.
Parameters
- $renderableToRemove : RenderableInterface