New in version 13.0
When using the email type, TYPO3 takes care of
generating the according database field.
A developer does not need to define this field in an extension's
ext_tables.sql file.
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 |
-
-
- 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_. It tells the DataHandler which fields of the localization records should be kept in sync if the underlying default or source record changes.state 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', );
-
- Type
- boolean
- Default
- false
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['autocomplete']
- Scope
- Display
Controls the
autocompleteattribute of a given email field. If set to true, adds attributeautocomplete="on"to the email input field allowing browser auto filling the field:'autocomplete' => true,Copied!
-
- 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.
Note
When selecting on unique-fields, make sure to select using
AND pid>=0since the field can contain duplicate values in other versions of records (always having PID = -1). This also means that if you are using versioning on a table where the unique-feature is used you cannot set the field to be truly unique in the database either! - uniqueInPid
- Requires the field to be unique for the current PID among other records on the same page. Evaluated on the server only.
Two speakers in the same storage folder cannot have the same email address:
<?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',
);
-
For details see fieldInformation.
-
-
- Type
- array
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']
For details see defaultLanguageDifferences.
-
- Type
- array
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']
For details see localizationStateSelector.
-
- Type
- array
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']
For details see otherLanguageContent.
-
- Type
- string (keywords)
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['mode']
- Scope
- Display
Possible keywords:
useOr Override Placeholder This property is related to the
placeholderproperty. 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 beNULL.Warning
In order for this property to apply properly, option nullable must be set to
true.
-
- 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
NULLin 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 aNULL.When the eval option is set to
uniqueoruniquemultipleIn Pid nullvalues are still possible.The database field must allow the
NULLvalue.
'nullable' => true,
-
- 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', );
-
- 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.
Warning
This property affects only the display. It is still possible to write to those fields when using the DataHandler.
-
- 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.
-
- 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
emailare considered searchable. To exclude a field from being searchable, set the following in the field's TCA configuration:'searchable' => false,Copied!
-
- 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.
-
- 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
appendandprependwere removed, and TYPO3 ignores the optionmode. TYPO3 migrates items with numeric keys to the keyslabelandvalue.- items (array)
- A list of selectable items. Each item is an associative array:
['label' => 'Shown label', 'value' => 'info@example.. The label can be plain text or a label reference.org']
The contact email of a conference with its value picker opened
<?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',
);
Note
The softref definition
'softref' => 'email is automatically applied
to all email fields.