Attention

TYPO3 v8 has reached its end-of-life March 31st, 2020 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.

There is no further ELTS support. It is recommended that you upgrade your project and use a supported version of TYPO3.

type = 'user'

Introduction

Allows to render a whole form field by a developer defined class method.

Note

type='user' is outdated and currently mostly only kept for compatibility reasons. The 'renderType' approach which can be extended by extensions is much more powerful. See FormEngine for details.

Examples

A sample user-defined field

A sample user-defined field

TCA configuration:

'tx_examples_special' => [
    'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_special',
    'config' => [
        'type' => 'user',
        'userFunc' => Documentation\Examples\Userfuncs\Tca::class . '->specialField',
        'parameters' => [
            'color' => 'blue'
        ],
    ],
],

This is how the corresponding PHP method in class \Documentation\Examples\Userfuncs\Tca looks like:

public function specialField($PA, $fObj)
{
    $color = (isset($PA['parameters']['color'])) ? $PA['parameters']['color'] : 'red';
    $formField  = '<div style="padding: 5px; background-color: ' . $color . ';">';
    $formField .= '<input type="text" name="' . $PA['itemFormElName'] . '"';
    $formField .= ' value="' . htmlspecialchars($PA['itemFormElValue']) . '"';
    $formField .= ' onchange="' . htmlspecialchars(implode('', $PA['fieldChangeFunc'])) . '"';
    $formField .= $PA['onFocus'];
    $formField .= ' /></div>';
    return $formField;
}

Properties renderType default

noTableWrapping

Datatype

boolean

Scope

Display

Description

If set to true, the output from the user function will not be wrapped in the usual table - you will have to do that yourself.

parameters

Datatype

array

Scope

Display / Proc.

Description

Array passed to the userFunc as the "parameters" key of the first argument received by the user function.

userFunc

Datatype

string (class->method reference)

Scope

Display / Proc.

Description

[classname]->[methodname]

Two arguments will be passed: The first argument is an array (passed by reference) which contains information about the current field being rendered. The second argument is a reference to the parent object, an instance of the TYPO3\CMS\Backend\Form\Element\UserElement wrapper class.

The array with current information will contain any parameters declared with the "parameters" property.