NodeFactory
Create an element object depending on renderType.
This is the main factory to instantiate any node within the render chain of FormEngine. All nodes must implement NodeInterface.
Nodes are "container" classes of the render chain, "element" classes that render single elements, as well as "fieldWizard", "fieldInformation" and "fieldControl" classes which are called by single elements to enrich them.
This factory gets a string "renderType" and then looks up in a list which specific class should handle this renderType. This list can be extended with own renderTypes by extensions, existing renderTypes can be overridden, and
- for complex cases - it is possible to register own resolver classes for single renderTypes that can return a node class name to override the default lookup list.
Table of Contents
Properties
- $nodeResolver : array<string|int, mixed>
- Node resolver classes Nested array with nodeName as key, (sorted) priority as sub key and class as value
- $nodeTypes : array<string|int, mixed>
- Default registry of node name to handling class
Methods
- __construct() : mixed
- Set up factory. Initialize additionally registered nodes.
- create() : NodeInterface
- Create a node depending on type
- initializeNodeResolver() : mixed
- Add resolver and add them sorted to a local property.
- instantiate() : object
- Instantiate given class name
- registerAdditionalNodeTypesFromConfiguration() : mixed
- Add node types from nodeRegistry to $this->nodeTypes.
Properties
$nodeResolver
Node resolver classes Nested array with nodeName as key, (sorted) priority as sub key and class as value
protected
array<string|int, mixed>
$nodeResolver
= []
$nodeTypes
Default registry of node name to handling class
protected
array<string|int, mixed>
$nodeTypes
= [
// Default container classes
'flex' => \TYPO3\CMS\Backend\Form\Container\FlexFormEntryContainer::class,
'flexFormContainerContainer' => \TYPO3\CMS\Backend\Form\Container\FlexFormContainerContainer::class,
'flexFormElementContainer' => \TYPO3\CMS\Backend\Form\Container\FlexFormElementContainer::class,
'flexFormNoTabsContainer' => \TYPO3\CMS\Backend\Form\Container\FlexFormNoTabsContainer::class,
'flexFormSectionContainer' => \TYPO3\CMS\Backend\Form\Container\FlexFormSectionContainer::class,
'flexFormTabsContainer' => \TYPO3\CMS\Backend\Form\Container\FlexFormTabsContainer::class,
'fullRecordContainer' => \TYPO3\CMS\Backend\Form\Container\FullRecordContainer::class,
'inline' => \TYPO3\CMS\Backend\Form\Container\InlineControlContainer::class,
'siteLanguage' => \TYPO3\CMS\Backend\Form\Container\SiteLanguageContainer::class,
'inlineRecordContainer' => \TYPO3\CMS\Backend\Form\Container\InlineRecordContainer::class,
'listOfFieldsContainer' => \TYPO3\CMS\Backend\Form\Container\ListOfFieldsContainer::class,
'noTabsContainer' => \TYPO3\CMS\Backend\Form\Container\NoTabsContainer::class,
'outerWrapContainer' => \TYPO3\CMS\Backend\Form\Container\OuterWrapContainer::class,
'paletteAndSingleContainer' => \TYPO3\CMS\Backend\Form\Container\PaletteAndSingleContainer::class,
'singleFieldContainer' => \TYPO3\CMS\Backend\Form\Container\SingleFieldContainer::class,
'tabsContainer' => \TYPO3\CMS\Backend\Form\Container\TabsContainer::class,
// Default single element classes
'check' => \TYPO3\CMS\Backend\Form\Element\CheckboxElement::class,
'checkboxToggle' => \TYPO3\CMS\Backend\Form\Element\CheckboxToggleElement::class,
'checkboxLabeledToggle' => \TYPO3\CMS\Backend\Form\Element\CheckboxLabeledToggleElement::class,
'group' => \TYPO3\CMS\Backend\Form\Element\GroupElement::class,
'input' => \TYPO3\CMS\Backend\Form\Element\InputTextElement::class,
'inputDateTime' => \TYPO3\CMS\Backend\Form\Element\InputDateTimeElement::class,
'inputLink' => \TYPO3\CMS\Backend\Form\Element\InputLinkElement::class,
'hidden' => \TYPO3\CMS\Backend\Form\Element\InputHiddenElement::class,
'imageManipulation' => \TYPO3\CMS\Backend\Form\Element\ImageManipulationElement::class,
'none' => \TYPO3\CMS\Backend\Form\Element\NoneElement::class,
'radio' => \TYPO3\CMS\Backend\Form\Element\RadioElement::class,
'selectCheckBox' => \TYPO3\CMS\Backend\Form\Element\SelectCheckBoxElement::class,
'selectMultipleSideBySide' => \TYPO3\CMS\Backend\Form\Element\SelectMultipleSideBySideElement::class,
'selectTree' => \TYPO3\CMS\Backend\Form\Element\SelectTreeElement::class,
'selectSingle' => \TYPO3\CMS\Backend\Form\Element\SelectSingleElement::class,
'selectSingleBox' => \TYPO3\CMS\Backend\Form\Element\SelectSingleBoxElement::class,
'colorpicker' => \TYPO3\CMS\Backend\Form\Element\InputColorPickerElement::class,
// t3editor is defined with a fallback so extensions can use it even if ext:t3editor is not loaded
't3editor' => \TYPO3\CMS\Backend\Form\Element\TextElement::class,
'text' => \TYPO3\CMS\Backend\Form\Element\TextElement::class,
'textTable' => \TYPO3\CMS\Backend\Form\Element\TextTableElement::class,
'unknown' => \TYPO3\CMS\Backend\Form\Element\UnknownElement::class,
'user' => \TYPO3\CMS\Backend\Form\Element\UserElement::class,
// special renderType for type="user" on sys_file_storage is_public column
'userSysFileStorageIsPublic' => \TYPO3\CMS\Backend\Form\Element\UserSysFileStorageIsPublicElement::class,
'fileInfo' => \TYPO3\CMS\Backend\Form\Element\FileInfoElement::class,
'mfaInfo' => \TYPO3\CMS\Backend\Form\Element\MfaInfoElement::class,
'slug' => \TYPO3\CMS\Backend\Form\Element\InputSlugElement::class,
'language' => \TYPO3\CMS\Backend\Form\Element\SelectSingleElement::class,
'category' => \TYPO3\CMS\Backend\Form\Element\CategoryElement::class,
'passthrough' => \TYPO3\CMS\Backend\Form\Element\PassThroughElement::class,
'belayoutwizard' => \TYPO3\CMS\Backend\Form\Element\BackendLayoutWizardElement::class,
// Default classes to enrich single elements
'fieldControl' => \TYPO3\CMS\Backend\Form\NodeExpansion\FieldControl::class,
'fieldInformation' => \TYPO3\CMS\Backend\Form\NodeExpansion\FieldInformation::class,
'fieldWizard' => \TYPO3\CMS\Backend\Form\NodeExpansion\FieldWizard::class,
// Element information
'tcaDescription' => \TYPO3\CMS\Backend\Form\FieldInformation\TcaDescription::class,
'adminIsSystemMaintainer' => \TYPO3\CMS\Backend\Form\FieldInformation\AdminIsSystemMaintainer::class,
'backendLayoutFromParentPage' => \TYPO3\CMS\Backend\Form\FieldInformation\BackendLayoutFromParentPage::class,
// Element wizards
'defaultLanguageDifferences' => \TYPO3\CMS\Backend\Form\FieldWizard\DefaultLanguageDifferences::class,
'localizationStateSelector' => \TYPO3\CMS\Backend\Form\FieldWizard\LocalizationStateSelector::class,
'otherLanguageContent' => \TYPO3\CMS\Backend\Form\FieldWizard\OtherLanguageContent::class,
'otherLanguageThumbnails' => \TYPO3\CMS\Backend\Form\FieldWizard\OtherLanguageThumbnails::class,
'recordsOverview' => \TYPO3\CMS\Backend\Form\FieldWizard\RecordsOverview::class,
'selectIcons' => \TYPO3\CMS\Backend\Form\FieldWizard\SelectIcons::class,
'tableList' => \TYPO3\CMS\Backend\Form\FieldWizard\TableList::class,
// Element controls
'addRecord' => \TYPO3\CMS\Backend\Form\FieldControl\AddRecord::class,
'editPopup' => \TYPO3\CMS\Backend\Form\FieldControl\EditPopup::class,
'elementBrowser' => \TYPO3\CMS\Backend\Form\FieldControl\ElementBrowser::class,
'insertClipboard' => \TYPO3\CMS\Backend\Form\FieldControl\InsertClipboard::class,
'linkPopup' => \TYPO3\CMS\Backend\Form\FieldControl\LinkPopup::class,
'listModule' => \TYPO3\CMS\Backend\Form\FieldControl\ListModule::class,
'resetSelection' => \TYPO3\CMS\Backend\Form\FieldControl\ResetSelection::class,
]
Methods
__construct()
Set up factory. Initialize additionally registered nodes.
public
__construct() : mixed
create()
Create a node depending on type
public
create(array<string|int, mixed> $data) : NodeInterface
Parameters
- $data : array<string|int, mixed>
-
All information to decide which class should be instantiated and given down to sub nodes
Tags
Return values
NodeInterfaceinitializeNodeResolver()
Add resolver and add them sorted to a local property.
protected
initializeNodeResolver() : mixed
This can be used to manipulate the nodeName to class resolution with own code.
Tags
instantiate()
Instantiate given class name
protected
instantiate(string $className, array<string|int, mixed> $data) : object
Parameters
- $className : string
-
Given class name
- $data : array<string|int, mixed>
-
Main data array
Return values
objectregisterAdditionalNodeTypesFromConfiguration()
Add node types from nodeRegistry to $this->nodeTypes.
protected
registerAdditionalNodeTypesFromConfiguration() : mixed
This can be used to add new render types or to overwrite existing node types. The registered class must implement the NodeInterface and will be called if a node with this renderType is rendered.