‪TYPO3CMS  ‪main
TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement Class Reference
Inheritance diagram for TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement:
TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface 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\Date TYPO3\CMS\Form\Domain\Model\FormElements\DatePicker TYPO3\CMS\Form\Domain\Model\FormElements\FileUpload TYPO3\CMS\Form\Domain\Model\FormElements\GenericFormElement TYPO3\CMS\Form\Tests\Unit\Domain\FormElements\Fixtures\TestingFormElement

Public Member Functions

 __construct (string $identifier, string $type)
 
 initializeFormElement ()
 
 getUniqueIdentifier ()
 
 setOptions (array $options, bool $resetValidators=false)
 
mixed getDefaultValue ()
 
 setDefaultValue ($defaultValue)
 
 isRequired ()
 
 setProperty (string $key, $value)
 
 getProperties ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable
 getType ()
 
 getIdentifier ()
 
 setIdentifier (string $identifier)
 
 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 ()
 
 registerInFormIfPossible ()
 
 onRemoveFromParentRenderable ()
 
 getIndex ()
 
 setIndex (int $index)
 
 getLabel ()
 
 setLabel (string $label)
 
 getTemplateName ()
 
 isEnabled ()
 
RenderableVariantInterface[] getVariants ()
 
 createVariant (array $options)
 
 addVariant (RenderableVariantInterface $variant)
 
 applyVariant (RenderableVariantInterface $variant)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface
 setRenderingOption (string $key, $value)
 
SplObjectStorage< ValidatorInterfacegetValidators ()
 
 addValidator (ValidatorInterface $validator)
 
 setDataType (string $dataType)
 

Protected Attributes

array $properties = 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 form element, which is 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 FormDefinition for an in-depth explanation.

Subclassing this class is a good starting-point for implementing custom PHP-based Form Elements.

Most of the functionality and API is implemented in \TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable, so make sure to check out this class as well.

Still, it is quite rare that you need to subclass this class; often you can just use the \TYPO3\CMS\Form\Domain\Model\FormElements\GenericFormElement and replace some templates.

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

Definition at line 49 of file AbstractFormElement.php.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor. Needs this FormElement's identifier and the FormElement type

Parameters
string$identifier‪The FormElement's identifier
string$type‪The Form Element Type
Exceptions
IdentifierNotValidException

Definition at line 62 of file AbstractFormElement.php.

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

Member Function Documentation

◆ getDefaultValue()

mixed TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::getDefaultValue ( )

Get the default value of the element

Returns
‪mixed

Implements TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface.

Definition at line 117 of file AbstractFormElement.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\getRootForm().

◆ getProperties()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::getProperties ( )

◆ getUniqueIdentifier()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::getUniqueIdentifier ( )

Get the global unique identifier of the element

Implements TYPO3\CMS\Form\Domain\Model\FormElements\FormElementInterface.

Definition at line 89 of file AbstractFormElement.php.

References TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable\getRootForm().

◆ initializeFormElement()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::initializeFormElement ( )

◆ isRequired()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::isRequired ( )

◆ setDefaultValue()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::setDefaultValue (   $defaultValue)

◆ setOptions()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::setOptions ( array  $options,
bool  $resetValidators = false 
)

Set multiple properties of this object at once. Every property which has a corresponding set* method can be set using the passed $options array.

Reimplemented from TYPO3\CMS\Form\Domain\Model\Renderable\AbstractRenderable.

Definition at line 97 of file AbstractFormElement.php.

References TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement\setDefaultValue(), and TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement\setProperty().

◆ setProperty()

TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::setProperty ( string  $key,
  $value 
)

Member Data Documentation

◆ $properties

array TYPO3\CMS\Form\Domain\Model\FormElements\AbstractFormElement::$properties = array( )
protected