Email 

New in version 13.0

The TCA type email should be used to input values representing email addresses.

The according database field is generated automatically.

Table of contents:

Properties of the TCA column type email 

Name Type Scope
boolean Proc.
boolean Display
string (list of keywords) Display / Proc.
array
array
array
string (keywords) Display
boolean Proc.
integer Unix timestamp Display
boolean Display
boolean Display / Proc.
boolean Display
integer Display
array Display
behaviour
allowLanguageSynchronization
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['behaviour']['allowLanguageSynchronization']
Scope
Proc.

Allows an editor to select in a localized record whether the value is copied over from default or source language record, or if the field has an own value in the localization. If set to true and if the table supports localization and if a localized record is edited, this setting enables FieldWizard LocalizationStateSelector: Two or three radio buttons shown below the field input. The state of this is stored in a json encoded array in the database table called l10n_state. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.

EXT:my_extension/Configuration/TCA/Overrides/140-tx_myextension_conference-contact_email.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
  'contact_email' => [
    'label' => 'my_extension.db:conference.contact_email',
    'config' => [
      'type' => 'email',
      'placeholder' => 'info@example.org',
      // The addresses of the organizers to choose from
      'valuePicker' => [
        'items' => [
          [
            'label' => 'my_extension.db:conference.contact_email.info',
            'value' => 'info@example.org',
          ],
          [
            'label' => 'my_extension.db:conference.contact_email.program',
            'value' => 'program@example.org',
          ],
          [
            'label' => 'my_extension.db:conference.contact_email.sponsoring',
            'value' => 'sponsoring@example.org',
          ],
        ],
      ],
      'behaviour' => [
        'allowLanguageSynchronization' => true,
      ],
    ],
  ],
]);
ExtensionManagementUtility::addToAllTCAtypes(
  'tx_myextension_conference',
  'contact_email',
  '',
  'before:--div--;core.form.tabs:categories',
);
Copied!
autocomplete
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['autocomplete']
Scope
Display

Controls the autocomplete attribute of a given email field. If set to true, adds attribute autocomplete="on" to the email input field allowing browser auto filling the field:

'autocomplete' => true,
Copied!
eval
Type
string (list of keywords)
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['eval']
Scope
Display / Proc.

Configuration of field evaluation.

Some of these evaluation keywords will trigger a JavaScript pre- evaluation in the form. Other evaluations will be performed in the backend. The evaluation functions will be executed in the list-order. Keywords:

unique

Requires the field to be unique for the whole table. Evaluated on the server only.

uniqueInPid
Requires the field to be unique for the current PID among other records on the same page. Evaluated on the server only.
Example: The email address of a speaker is unique in the storage folder

Two speakers in the same storage folder cannot have the same email address:

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!
fieldInformation

For details see fieldInformation.

fieldWizard
defaultLanguageDifferences
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']

For details see defaultLanguageDifferences.

localizationStateSelector
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']

For details see localizationStateSelector.

otherLanguageContent
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']

For details see otherLanguageContent.

mode
Type
string (keywords)
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
Scope
Display

Possible keywords: useOrOverridePlaceholder

This property is related to the placeholder property. When defined, a checkbox will appear above the field. If that box is checked, the field can be used to enter whatever the user wants as usual. If the box is not checked, the field becomes read-only and the value saved to the database will be NULL .

nullable
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['nullable']
Scope
Proc.

If set to true, a checkbox will appear, which by default deactivates the field. In the deactivated state the field is saved as NULL in the database. By activating the checkbox it is possible to set a value. If nothing is entered into the field, then an empty string will be saved and not a NULL .

When the eval option is set to unique or uniqueInPid multiple null values are still possible.

The database field must allow the NULL value.

Example:
'nullable' => true,
Copied!
placeholder
Type
integer Unix timestamp
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
Scope
Display

Placeholder, containing a default date.

EXT:my_extension/Configuration/TCA/Overrides/140-tx_myextension_conference-contact_email.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
  'contact_email' => [
    'label' => 'my_extension.db:conference.contact_email',
    'config' => [
      'type' => 'email',
      'placeholder' => 'info@example.org',
      // The addresses of the organizers to choose from
      'valuePicker' => [
        'items' => [
          [
            'label' => 'my_extension.db:conference.contact_email.info',
            'value' => 'info@example.org',
          ],
          [
            'label' => 'my_extension.db:conference.contact_email.program',
            'value' => 'program@example.org',
          ],
          [
            'label' => 'my_extension.db:conference.contact_email.sponsoring',
            'value' => 'sponsoring@example.org',
          ],
        ],
      ],
      'behaviour' => [
        'allowLanguageSynchronization' => true,
      ],
    ],
  ],
]);
ExtensionManagementUtility::addToAllTCAtypes(
  'tx_myextension_conference',
  'contact_email',
  '',
  'before:--div--;core.form.tabs:categories',
);
Copied!
readOnly
Type
boolean
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['readOnly']
Scope
Display

Renders the field in a way that the user can see the values but cannot edit them. The rendering is as similar as possible to the normal rendering but may differ in layout and size.

required
Type
boolean
Default
false
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['required']
Scope
Display / Proc.

If set to true a non-empty value is required in the field. Otherwise the form cannot be saved.

searchable
Type
boolean
Default
true
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['searchable']
Scope
Display

New in version 14.0

TYPO3 now automatically includes all fields of suitable types in backend search operations in the Content > Records module.

This option can be used to explicitly exclude fields from being searchable, instead of having to list them in the now removed option $GLOBALS['TCA'][$table]['ctrl']['searchFields'].

By default, all fields of type email are considered searchable. To exclude a field from being searchable, set the following in the field's TCA configuration:

'searchable' => false,
Copied!
size
Type
integer
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['size']
Scope
Display

Abstract value for the width of the <input> field. To set the email field to the full width of the form area, use the value 50. Minimum is 10. Default is 30.

valuePicker
Type
array
TCA path
$GLOBALS['TCA'][$table]['columns'][$field]['config']['valuePicker']
Scope
Display
Changed
14.0, Breaking: #107677 - Drop prepend and append modes from TCA value picker

Renders a list of email addresses to choose from below the field. The editor can still type another address. When the editor selects an item, its value replaces the current value of the field.

Changed in version 14.0

The modes append and prepend were removed, and TYPO3 ignores the option mode. TYPO3 migrates items with numeric keys to the keys label and value.

items (array)
A list of selectable items. Each item is an associative array: ['label' => 'Shown label', 'value' => 'info@example.org'] . The label can be plain text or a label reference.
Example: The addresses of the organizers to choose from
The field "Contact email" with the value "team@example.org" and its list opened: "General questions (info@example.org)", "Program (program@example.org)", and "Sponsoring (sponsoring@example.org)"

The contact email of a conference with its value picker opened

EXT:my_extension/Configuration/TCA/Overrides/140-tx_myextension_conference-contact_email.php
<?php

use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;

defined('TYPO3') or die();

ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
  'contact_email' => [
    'label' => 'my_extension.db:conference.contact_email',
    'config' => [
      'type' => 'email',
      'placeholder' => 'info@example.org',
      // The addresses of the organizers to choose from
      'valuePicker' => [
        'items' => [
          [
            'label' => 'my_extension.db:conference.contact_email.info',
            'value' => 'info@example.org',
          ],
          [
            'label' => 'my_extension.db:conference.contact_email.program',
            'value' => 'program@example.org',
          ],
          [
            'label' => 'my_extension.db:conference.contact_email.sponsoring',
            'value' => 'sponsoring@example.org',
          ],
        ],
      ],
      'behaviour' => [
        'allowLanguageSynchronization' => true,
      ],
    ],
  ],
]);
ExtensionManagementUtility::addToAllTCAtypes(
  'tx_myextension_conference',
  'contact_email',
  '',
  'before:--div--;core.form.tabs:categories',
);
Copied!