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.
Tags
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
- initializeNodeClass() : NodeInterface
- Instantiate a NodeInterface class and set data.
- initializeNodeResolverClass() : NodeResolverInterface
- Instantiate a NodeResolverInterface class and set data.
- registerAdditionalNodeTypesFromConfiguration() : void
- Add node types from nodeRegistry to $this->nodeTypes.
- registerNodeResolvers() : void
- Add resolver and add them sorted to a local property.
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,
'inlineRecordContainer' => \TYPO3\CMS\Backend\Form\Container\InlineRecordContainer::class,
\TYPO3\CMS\Backend\Form\Container\FilesControlContainer::NODE_TYPE_IDENTIFIER => \TYPO3\CMS\Backend\Form\Container\FilesControlContainer::class,
\TYPO3\CMS\Backend\Form\Container\FileReferenceContainer::NODE_TYPE_IDENTIFIER => \TYPO3\CMS\Backend\Form\Container\FileReferenceContainer::class,
'siteLanguage' => \TYPO3\CMS\Backend\Form\Container\SiteLanguageContainer::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,
'email' => \TYPO3\CMS\Backend\Form\Element\EmailElement::class,
'group' => \TYPO3\CMS\Backend\Form\Element\GroupElement::class,
'folder' => \TYPO3\CMS\Backend\Form\Element\FolderElement::class,
'input' => \TYPO3\CMS\Backend\Form\Element\InputTextElement::class,
'number' => \TYPO3\CMS\Backend\Form\Element\NumberElement::class,
'datetime' => \TYPO3\CMS\Backend\Form\Element\DatetimeElement::class,
'link' => \TYPO3\CMS\Backend\Form\Element\LinkElement::class,
'password' => \TYPO3\CMS\Backend\Form\Element\PasswordElement::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,
'color' => \TYPO3\CMS\Backend\Form\Element\ColorElement::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,
'json' => \TYPO3\CMS\Backend\Form\Element\JsonElement::class,
'uuid' => \TYPO3\CMS\Backend\Form\Element\UuidElement::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,
'passwordGenerator' => \TYPO3\CMS\Backend\Form\FieldControl\PasswordGenerator::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
NodeInterfaceinitializeNodeClass()
Instantiate a NodeInterface class and set data.
protected
initializeNodeClass(string $className, array<string|int, mixed> $data) : NodeInterface
Parameters
- $className : string
- $data : array<string|int, mixed>
-
Main data array
Return values
NodeInterfaceinitializeNodeResolverClass()
Instantiate a NodeResolverInterface class and set data.
protected
initializeNodeResolverClass(string $className, array<string|int, mixed> $data) : NodeResolverInterface
Parameters
- $className : string
- $data : array<string|int, mixed>
-
Main data array
Return values
NodeResolverInterfaceregisterAdditionalNodeTypesFromConfiguration()
Add node types from nodeRegistry to $this->nodeTypes.
protected
registerAdditionalNodeTypesFromConfiguration() : void
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.
Tags
registerNodeResolvers()
Add resolver and add them sorted to a local property.
protected
registerNodeResolvers() : void
This can be used to manipulate the nodeName to class resolution with own code.