DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
Available Fieldtypes¶
DataViewer delivers various fieldtypes as preconfigured TCA. With these, you are more flexible and faster to create a form as you need it.
Creating new Fieldtypes (Developer)¶
Fieldtypes can be added via TypoScript in the Plugin Settings. See the following example code to add a custom field.
Here is the example code for adding a new fieldtype to the configuration.
TypoScript
plugin.tx_dataviewer.fieldtypes {
# Fieldtype Declaration for a new field #
customfieldtype {
fieldClass = Vendor\Extension\Fieldtype\CustomFieldtype
valueClass = Vendor\Extension\Fieldvalue\CustomFieldtype
icon = EXT:extension/Resources/Public/Icons/customfieldtype.gif
label = LLL:EXT:extension/Resources/Private/Language/locallang.xlf:type.customfieldtype
flexConfiguration = EXT:extension/Configuration/FlexForms/Fieldtype/CustomFieldtype.xml
}
}
The fieldtype needs to have a fieldClass and a valueClass.
The fieldClass is used for generating the field in the backend and has to extend
\MageDeveloper\Dataviewer\Form\Fieldtype\AbstractFieldtype
and implement
\MageDeveloper\Dataviewer\Form\Fieldtype\FieldtypeInterface
The valueClass has to extend \MageDeveloper\Dataviewer\Form\Fieldvalue\AbstractFieldvalue
and implement \MageDeveloper\Dataviewer\Form\Fieldvalue\FieldvalueInterface
Fieldtype Configuration
It is possible to add a custom configuration to the fieldtype with flexConfiguration =
.
The flexConfiguration-File has to contain valid flexform for the additional configuration.
That configuration is available in the files through $this->getField()->getConfig('yourFlexformConfigNode')
.