fieldInformation 

The fieldInformation is a reserved area within a single form element between the label and the form element itself.

fieldInformation
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldInformation']
Scope
Display

Extensions can register their own field information nodes, as shown in the following example.

Example 

The email address of a speaker shows a translated information text below its label. The label reference of the text is passed to the node in the options of its fieldInformation configuration:

The email address of a speaker with an information text

The email address of a speaker with an information text

EXT:my_extension/Configuration/TCA/Overrides/310-tx_myextension_speaker-email.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

ExtensionManagementUtility::addTCAcolumns('tx_myextension_speaker', [
  'email' => [
    'label' => 'my_extension.db:speaker.email',
    'l10n_mode' => 'exclude',
    'config' => [
      'type' => 'email',
      'eval' => 'uniqueInPid',
      'fieldInformation' => [
        'informationText' => [
          // Registered in ext_localconf.php
          'renderType' => 'informationText',
          'options' => [
            'text' => 'my_extension.db:speaker.email.information',
          ],
        ],
      ],
    ],
  ],
]);
ExtensionManagementUtility::addToAllTCAtypes(
  'tx_myextension_speaker',
  'email',
  '',
  'before:--div--;my_extension.db:tab.integration',
);
Copied!

The node receives the options in $this->data['renderData']['fieldInformationOptions'] and returns the HTML to show:

EXT:my_extension/Classes/Form/FieldInformation/InformationText.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Form\FieldInformation;

use TYPO3\CMS\Backend\Form\AbstractNode;
use TYPO3\CMS\Core\Localization\LanguageService;

/**
 * Shows the text of the option "text" between the label and the field
 */
final class InformationText extends AbstractNode
{
  public function render(): array
  {
    $result = $this->initializeResultArray();
    $label = (string)($this->data['renderData']['fieldInformationOptions']['text'] ?? '');
    $result['html'] = '<p class="text-body-secondary">'
      . htmlspecialchars($this->getLanguageService()->sL($label))
      . '</p>';
    return $result;
  }

  private function getLanguageService(): LanguageService
  {
    return $GLOBALS['LANG'];
  }
}
Copied!

The node is registered with the name used as renderType in ext_localconf.php:

EXT:my_extension/ext_localconf.php
<?php

use MyVendor\MyExtension\Controller\ConferenceController;
use MyVendor\MyExtension\Evaluation\AbstractEvaluation;
use MyVendor\MyExtension\Evaluation\HashtagEvaluation;
use MyVendor\MyExtension\Form\Element\BadgeNameElement;
use MyVendor\MyExtension\Form\FieldInformation\InformationText;
use MyVendor\MyExtension\Form\FieldInformation\TalkOrderInformation;
use MyVendor\MyExtension\Form\FieldWizard\ReferencesToThisRecordWizard;
use TYPO3\CMS\Core\PasswordPolicy\Generator\PasswordGenerator;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;

defined('TYPO3') or die();

ExtensionUtility::configurePlugin(
  'MyExtension',
  'ConferenceList',
  [ConferenceController::class => ['list', 'show']],
);

// Classes that TCA fields name in 'eval'
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][HashtagEvaluation::class] = '';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][AbstractEvaluation::class] = '';

// The information above the talks of a conference, see
// Configuration/TCA/Overrides/120-tx_myextension_conference-talks.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1791234567] = [
  'nodeName' => 'talkOrderInformation',
  'priority' => 30,
  'class' => TalkOrderInformation::class,
];

// The badge name of a frontend user, see
// Configuration/TCA/Overrides/650-fe_users-tx_myextension_badge_name.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1791300000] = [
  'nodeName' => 'badgeName',
  'priority' => 40,
  'class' => BadgeNameElement::class,
];

// The information text of fields, see for example
// Configuration/TCA/Overrides/310-tx_myextension_speaker-email.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1791310000] = [
  'nodeName' => 'informationText',
  'priority' => 30,
  'class' => InformationText::class,
];

// The references to a conference above its form, see
// Configuration/TCA/Overrides/101-tx_myextension_conference-references.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1791320000] = [
  'nodeName' => 'referencesToThisRecord',
  'priority' => 30,
  'class' => ReferencesToThisRecordWizard::class,
];

// The password policies of the password generators, see
// Configuration/TCA/Overrides/445-tx_myextension_location-door_code.php and
// Configuration/TCA/Overrides/345-tx_myextension_speaker-upload_token.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies']['myExtensionDigits'] = [
  'generator' => [
    'className' => PasswordGenerator::class,
    'options' => [
      'length' => 8,
      'lowerCaseCharacters' => false,
      'upperCaseCharacters' => false,
      'digitCharacters' => true,
    ],
  ],
  'validators' => [],
];
$GLOBALS['TYPO3_CONF_VARS']['SYS']['passwordPolicies']['myExtensionBase64'] = [
  'generator' => [
    'className' => PasswordGenerator::class,
    'options' => [
      'length' => 35,
      'random' => 'base64',
    ],
  ],
  'validators' => [],
];
Copied!