Attention

TYPO3 v9 has reached its end-of-life September 30th, 2021 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.

You can order Extended Long Term Support (ELTS) here: TYPO3 ELTS.

type = 'user'

Introduction

There are three columns config types that do similar things but still have subtle differences between them. These are the none type, the passthrough type and the user type.

Characteristics of user:

  • A value sent to the DataHandler is just kept as is and put into the database field. Default FormEngine however never sends values.

  • Unlike none, type user must have a database field.

  • FormEngine only renders a dummy element for type user fields by default. It should be combined with a custom renderType.

  • Type user field values are rendered as-is at other places in the backend. They for instance can be selected to be displayed in the list module "singel table view".

  • Field updates by the DataHandler get logged and the history/undo function will work with such values.

The user field can be useful, if:

  • A special rendering and evaluation is needed for a value when editing records via FormEngine.

Deprecated since version 9.5: The property userFunc of type='user' has been deprecated with TYPO3 9.5 and removed with TYPO3 10. Override the node in the FormEngine Rendering instead. See example below.

Examples

The example registers an own node element a TCA field using it and a class implementing a rendering. See FormEngine docs for more details on this.

Register an own node element:

// Register a node in ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][<unix timestamp of "now">] = [
    'nodeName' => 'lollisCustomMapElement',
    'priority' => 40,
    'class' => \Vendor\Extension\Form\Element\LollisCustomMapElement::class,
];

Use it as renderType in TCA:

'myMapElement' => [
    'label' => 'My map element',
    'config' => [
        'type' => 'user',
        'renderType' => 'lollisCustomMapElement',
        'parameters' => [
            'useOpenStreetMap' => true,
        ],
    ],
],

Add a class implementation:

<?php
declare(strict_types = 1);
namespace Vendor\Extension\Form\Element;

use TYPO3\CMS\Backend\Form\Element\AbstractFormElement;

class LollisCustomMapElement extends AbstractFormElement
{
    public function render()
    {
        // Custom TCA properties and other data can be found in $this->data, for example the above
        // parameters are available in $this->data['parameterArray']['fieldConf']['config']['parameters']
        $result = $this->initializeResultArray();
        $result['html'] = 'my map content';
        return $result;
    }
}

Properties renderType default

The default renderType just renders a dummy entry to indicate a custom renderType should be added.