‪TYPO3CMS  ‪main
TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection Class Reference
Inheritance diagram for TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection:
TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable TYPO3\CMS\Form\Domain\Model\Renderable\CompositeRenderableInterface TYPO3\CMS\Form\Domain\Model\Renderable\RenderableInterface TYPO3\CMS\Form\Domain\Model\Renderable\VariableRenderableInterface TYPO3\CMS\Form\Domain\Model\Renderable\RenderableInterface TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface TYPO3\CMS\Form\Domain\Model\FormElements\Page TYPO3\CMS\Form\Domain\Model\FormElements\Section TYPO3\CMS\Form\Tests\Unit\Domain\FormElements\Fixtures\AbstractSectionFixture TYPO3\CMS\Form\Domain\Model\FormElements\GridRow

Public Member Functions

 __construct (string $identifier, string $type)
 
FormElementInterface[] getElements ()
 
FormElementInterface[] getElementsRecursively ()
 
 addElement (FormElementInterface $formElement)
 
FormElementInterface createElement (string $identifier, string $typeName)
 
 moveElementBefore (FormElementInterface $elementToMove, FormElementInterface $referenceElement)
 
 moveElementAfter (FormElementInterface $elementToMove, FormElementInterface $referenceElement)
 
 removeElement (FormElementInterface $elementToRemove)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable
RenderableInterface[] getRenderablesRecursively ()
 
 registerInFormIfPossible ()
 
 onRemoveFromParentRenderable ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable
 getType ()
 
 getIdentifier ()
 
 setIdentifier (string $identifier)
 
 setOptions (array $options, bool $resetValidators=false)
 
 createValidator (string $validatorIdentifier, array $options=[])
 
 addValidator (ValidatorInterface $validator)
 
 getValidators ()
 
 setDataType (string $dataType)
 
 getRendererClassName ()
 
 getRenderingOptions ()
 
mixed setRenderingOption (string $key, $value)
 
CompositeRenderableInterface null getParentRenderable ()
 
 setParentRenderable (CompositeRenderableInterface $parentRenderable)
 
 getRootForm ()
 
 getIndex ()
 
 setIndex (int $index)
 
 getLabel ()
 
 setLabel (string $label)
 
 getTemplateName ()
 
 isEnabled ()
 
RenderableVariantInterface[] getVariants ()
 
 createVariant (array $options)
 
 addVariant (RenderableVariantInterface $variant)
 
 applyVariant (RenderableVariantInterface $variant)
 

Additional Inherited Members

- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable
 addRenderable (RenderableInterface $renderable)
 
 moveRenderableBefore (RenderableInterface $renderableToMove, RenderableInterface $referenceRenderable)
 
 moveRenderableAfter (RenderableInterface $renderableToMove, RenderableInterface $referenceRenderable)
 
 removeRenderable (RenderableInterface $renderableToRemove)
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable
TYPO3 CMS Form Domain Model Renderable RenderableInterface[] $renderables = array( )
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable
string $type
 
string $identifier
 
CompositeRenderableInterface null $parentRenderable
 
string $label = ''
 
array $renderingOptions = array( )
 
int $index = 0
 
string $templateName = ''
 
array $variants = array( )
 
ValidatorResolver $validatorResolver = null
 

Detailed Description

A base class for "section-like" form parts like "Page" or "Section" (which is rendered as "Fieldset")

This class contains multiple FormElements (FormElementInterface).

Please see FormDefinition for an in-depth explanation.

This class is NOT meant to be sub classed by developers. Scope: frontend

Definition at line 42 of file AbstractSection.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection::__construct ( string  $identifier,
string  $type 
)

Constructor. Needs the identifier and type of this element

Parameters
string$identifier‪The Section identifier
string$type‪The Section type
Exceptions
IdentifierNotValidException‪if the identifier was no non-empty string

Reimplemented in TYPO3\CMS\Form\Domain\Model\FormElements\Page.

Definition at line 51 of file AbstractSection.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\$identifier, and TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\$type.

Member Function Documentation

◆ addElement()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection::addElement ( FormElementInterface  $formElement)

Add a new form element at the end of the section

Parameters
FormElementInterface$formElement‪The form element to add
Exceptions
FormDefinitionConsistencyException‪if FormElement is already added to a section

Definition at line 87 of file AbstractSection.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable\addRenderable().

Referenced by TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection\createElement().

◆ createElement()

FormElementInterface TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection::createElement ( string  $identifier,
string  $typeName 
)

Create a form element with the given $identifier and attach it to this section/page.

  • ‪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
string$identifier‪Identifier of the new form element
string$typeName‪type of the new form element
Returns
FormElementInterface the newly created form element
Exceptions
TypeDefinitionNotFoundException
TypeDefinitionNotValidException

Definition at line 107 of file AbstractSection.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\$identifier, TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\$renderingOptions, TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection\addElement(), and TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\getRootForm().

◆ getElements()

FormElementInterface [] TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection::getElements ( )

Get the child Form Elements

Returns
FormElementInterface[] The Page's elements

Definition at line 66 of file AbstractSection.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable\$renderables.

◆ getElementsRecursively()

FormElementInterface [] TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection::getElementsRecursively ( )

◆ moveElementAfter()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection::moveElementAfter ( FormElementInterface  $elementToMove,
FormElementInterface  $referenceElement 
)

Move FormElement $element after $referenceElement

Both $element and $referenceElement must be direct descendants of this Section/Page.

Parameters
FormElementInterface$elementToMove
FormElementInterface$referenceElement

Definition at line 165 of file AbstractSection.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable\moveRenderableAfter().

◆ moveElementBefore()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection::moveElementBefore ( FormElementInterface  $elementToMove,
FormElementInterface  $referenceElement 
)

Move FormElement $element before $referenceElement.

Both $element and $referenceElement must be direct descendants of this Section/Page.

Parameters
FormElementInterface$elementToMove
FormElementInterface$referenceElement

Definition at line 152 of file AbstractSection.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable\moveRenderableBefore().

◆ removeElement()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractSection::removeElement ( FormElementInterface  $elementToRemove)

Remove $elementToRemove from this Section/Page

Definition at line 173 of file AbstractSection.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractCompositeRenderable\removeRenderable().