Some TCA config->types imply a certain way to render the field, for example the "link" type, or the "datetime" type
$GLOBALS['TCA']['my_table']['columns']['my_field'] = [
'label' => 'Mouse-interaction behaviour',
'config' => [
'type' => 'check',
'renderType'=>'checkboxToggle',
'items'=> [
['enlarge on click'],
['zoom on hover'],
],
],
];
for our little project
declare(strict_types=1);
namespace Talk\Classifieds\Backend\TCA;
use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;
class Base64ImageFormElement extends AbstractFormElement
{
public function render() {
$result = $this->initializeResultArray();
$parameterArray = $this->data['parameterArray'];
$result['html'] = 'Hello World
';
return $result;
}
}
$result = [
'additionalInlineLanguageLabelFiles' => [],
'stylesheetFiles' => [],
'javaScriptModules' => $javaScriptModules, // TYPO3 12
'requireJsModules' => $requireJsModules, // TYPO3 11 and older
'inlineData' => [],
'html' => '',
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1690219795] = [
'nodeName' => 'base64image',
'priority' => 10,
'class' => Base64ImageFormElement::class,
];
tx_classifieds_domain_model_add.php
'b64img' => [
'label' => 'Image',
'config' => [
'type' => 'text',
'cols' => 80, 'rows' => 15,
'renderType'=>'base64image'
],
],
$parameterArray['itemFormElName'] // the name="" part for a field
$parameterArray['itemFormElID'] // the id='' used with JS
$parameterArray['itemFormElValue'] // the value we're working with
$this->data['tableName'] // the table name where working on
$this->data['databaseRow'] // the Database Record
$this->data['vanillaUid'] // the UID of the record, check command:
$this->data['command'] // edit, or new
$this->data['effectivePid'] // the page id
$this->data['parentPageRow'] // the Database Record of the (parent) page
$this->data['site'] // if available the Site object (might be since v12)
$this->data['userTS'] // the userTS Config
$this->data['pageTS'] // the pageTS Config
$this->data['rootline'] // the page rootline
class InfosheetFormElement extends AbstractFormElement {
//
}
ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1690219795] = [
'nodeName' => 'infosheet',
'priority' => 10,
'class' => InfosheetFormElement::class,
];
tx_classifieds_domain_model_add.php
'global_information' => [
'label' => 'Infos',
'config' => [
'type' => 'none',
'renderType'=>'infosheet'
],
],
'fieldInformation' => [
'boothRepInfo'=>[
'renderType'=>'boothRepInfo',
],
],
'info_global'=>[
'label'=> 'Info',
'config'=>[
'type'=>'none',
'renderType'=>'invoiceGlobalInfo',
],
],
$GLOBALS['TCA']['tt_content']['columns']['header_icon'] = [
'exclude' => true,
'label' => 'Header Icon',
'config' => [
'type' => 'user',
'renderType' => 'headerIcons',
],
];
Twitter: @FoppelFB
Mastodon: @foppel@mastodon.cloud
fberger@sudhaus7.de
https://sudhaus7.de/
fberger@code711.de
https://code711.de/