fieldInformation
The field is a reserved area within a single form element between
the label and the form element itself.
-
- Type
- array
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldInformation']
- Scope
- Display
Currently, TYPO3 comes with following implemented field nodes:
Example
The field tags shows a translated information text next to its label.
The label reference of the text is passed to the node in the options of
its field configuration:
EXT:my_extension/Configuration/TCA/tx_myextension_product.php
<?php
return [
'ctrl' => [
'title' => 'Product',
'label' => 'tags',
],
'columns' => [
'tags' => [
'label' => 'Tags',
'config' => [
'type' => 'input',
'fieldInformation' => [
'tagInformation' => [
'renderType' => 'myExtensionTagInformation',
'options' => [
'text' => 'my_extension.db:tags.information',
],
],
],
],
],
],
'types' => [
'0' => [
'showitem' => 'tags',
],
],
];
The node receives the options in
$this->data and returns the
HTML to show:
EXT:my_extension/Classes/Backend/FieldInformation/TagInformation.php
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Backend\FieldInformation;
use TYPO3\CMS\Backend\Form\AbstractNode;
final class TagInformation extends AbstractNode
{
public function render(): array
{
$result = $this->initializeResultArray();
$label = $this->data['renderData']['fieldInformationOptions']['text'];
$result['html'] = htmlspecialchars(
$GLOBALS['LANG']->sL($label),
);
return $result;
}
}
The node is registered with the name used as render in
ext_:
EXT:my_extension/ext_localconf.php