text (multiline)
This page describes the text type with no renderType (default).
The according database field is generated automatically.
type='text' without a given specific renderType either renders a simple
<textarea> or a Rich Text field if
enableRichtext is enabled in TCA and
page TSconfig.
Table of contents:
Examples for multiline text fields
Multiline plain text area
The abstract of a talk
<?php
use MyVendor\MyExtension\Evaluation\AbstractEvaluation;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'abstract' => [
'label' => 'my_extension.db:talk.abstract',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 5,
'eval' => 'trim,' . AbstractEvaluation::class,
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'abstract',
'',
'before:--div--;core.form.tabs:access',
);
Rich text editor field
The description of a conference
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
'description' => [
'label' => 'my_extension.db:conference.description',
'l10n_mode' => 'prefixLangTitle',
'config' => [
'type' => 'text',
'enableRichtext' => true,
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_conference',
'description',
'',
'before:--div--;core.form.tabs:categories',
);
Properties of the TCA column type text with or without enabled rich text
| Name | Type | Scope |
|---|---|---|
| boolean | Proc. | |
| integer | Display | |
| string | Display / Proc. | |
| boolean | Display / Proc. | |
| boolean | Display | |
| string (list of keywords) | Display / Proc. | |
| array | ||
| array | ||
| array | ||
| boolean | Display | |
| string | Display / Proc. | |
| integer | Display | |
| integer | Display | |
| boolean | Proc. | |
| string | Display | |
| boolean | Display | |
| boolean | Display / Proc. | |
| string (keyword) | Display / Proc. | |
| integer | Display | |
| boolean | Display | |
| string | Proc. | |
| array | Display | |
| string (keyword) | 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/132-tx_myextension_conference-embed_code.php<?php use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; defined('TYPO3') or die(); ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [ 'embed_code' => [ 'label' => 'my_extension.db:conference.embed_code', 'config' => [ 'type' => 'text', 'renderType' => 'codeEditor', 'format' => 'html', 'rows' => 7, 'appearance' => [ 'lineWrapping' => true, ], 'behaviour' => [ 'allowLanguageSynchronization' => true, ], 'searchable' => false, ], ], ]); ExtensionManagementUtility::addToAllTCAtypes( 'tx_myextension_conference', 'embed_code', '', 'after:description', );
-
- Type
- integer
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['cols']
- Scope
- Display
Abstract value for the width of the
<textarea>field. To set the textarea to the full width of the form area, use the value 50. Default is 30.Does not apply to RTE fields.
The abstract of a talk
<?php
use MyVendor\MyExtension\Evaluation\AbstractEvaluation;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'abstract' => [
'label' => 'my_extension.db:talk.abstract',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 5,
'eval' => 'trim,' . AbstractEvaluation::class,
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'abstract',
'',
'before:--div--;core.form.tabs:access',
);
-
- Type
- string
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['default']
- Scope
- Display / Proc.
Default value set if a new record is created.
-
- Type
- boolean
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['enableRichtext']
- Scope
- Display / Proc.
If set to true, the system renders a Rich Text Editor if that is enabled for the editor (default: yes), and if a suitable editor extension is loaded (default: rteckeditor).
If either of these requirements is not met, the system falls back to a
<textarea>field.
The description of a conference
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [
'description' => [
'label' => 'my_extension.db:conference.description',
'l10n_mode' => 'prefixLangTitle',
'config' => [
'type' => 'text',
'enableRichtext' => true,
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_conference',
'description',
'',
'before:--div--;core.form.tabs:categories',
);
-
- Type
- boolean
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['enableTabulator']
- Scope
- Display
Enabling this allows to use tabs in a text field. This works well together with fixed-width fonts (monospace) for code editing.
Does not apply to RTE fields.
The requirements of a workshop in a fixed font
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'requirements' => [
'label' => 'my_extension.db:talk.requirements',
'config' => [
'type' => 'text',
'rows' => 3,
'fixedFont' => true,
'enableTabulator' => true,
'wrap' => 'off',
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'requirements',
'workshop',
'before:--div--;core.form.tabs:access',
);
-
- Type
- string (list of keywords)
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['eval']
- Scope
- Display / Proc.
- RenderType
- default
Configuration of field evaluation. None of these apply for RTE fields.
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, available keywords:
- trim
- The value in the field will have white spaces around it trimmed away.
MyVendor\ My Extension\* - User defined form evaluations.
Trimming the value for white space before storing in the database:
The abstract of a talk
<?php
use MyVendor\MyExtension\Evaluation\AbstractEvaluation;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'abstract' => [
'label' => 'my_extension.db:talk.abstract',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 5,
'eval' => 'trim,' . AbstractEvaluation::class,
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'abstract',
'',
'before:--div--;core.form.tabs:access',
);
You can supply own form evaluations in an extension by creating a class with two functions:
deevaluate called when opening the record and
evaluate
called for validation when saving the record. The field references the class
in eval:
<?php
use MyVendor\MyExtension\Evaluation\AbstractEvaluation;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'abstract' => [
'label' => 'my_extension.db:talk.abstract',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 5,
'eval' => 'trim,' . AbstractEvaluation::class,
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'abstract',
'',
'before:--div--;core.form.tabs:access',
);
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Evaluation;
/**
* Keeps the abstract of a talk to paragraphs separated by one blank line
*/
final class AbstractEvaluation
{
/**
* Evaluates the value before it is saved
*/
public function evaluateFieldValue(string $value): string
{
$value = str_replace(["\r\n", "\r"], "\n", $value);
return (string)preg_replace('/\n{3,}/', "\n\n", $value);
}
/**
* Prepares the value for the form
*/
public function deevaluateFieldValue(array $parameters): string
{
return (string)$parameters['value'];
}
}
The class is registered in 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' => [],
];
-
For details see fieldControl.
-
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.
The requirements of a workshop in a fixed font
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'requirements' => [
'label' => 'my_extension.db:talk.requirements',
'config' => [
'type' => 'text',
'rows' => 3,
'fixedFont' => true,
'enableTabulator' => true,
'wrap' => 'off',
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'requirements',
'workshop',
'before:--div--;core.form.tabs:access',
);
-
- Type
- string
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['is_in']
- Scope
- Display / Proc.
- RenderType
- textTable, default
If a user-defined evaluation is used for the field (see eval), then this value will be passed as argument to the user-defined evaluation function.
Does not apply to RTE fields.
-
- Type
- integer
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['max']
- Scope
- Display
- RenderType
- textTable, default
Adds the HTML5 attribute "maxlength" to a textarea. Prevents the field from adding more than specified number of characters. This is a client side restriction, no server side length restriction is enforced.
Does not apply for RTE fields.
The short biography of a speaker
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_speaker', [
'short_bio' => [
'label' => 'my_extension.db:speaker.short_bio',
'config' => [
'type' => 'text',
'rows' => 3,
'max' => 300,
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_speaker',
'short_bio',
'',
'before:--div--;my_extension.db:tab.integration',
);
-
- Type
- integer
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['min']
- Scope
- Display
This option allows to define a minimum number of characters for the
<input>field and adds aminlengthattribute to the field. If at least one character is typed in and the number of characters is less thanmin, the FormEngine marks the field as invalid, preventing the user to save the element. DataHandler will also take care for server-side validation and reset the value to an empty string, ifminis not reached.When using
minin combination with max, one has to make sure, theminvalue is less than or equalmax. Otherwise the option is ignored.Empty fields are not validated. If one needs to have non-empty values, it is recommended to use
required => truein combination withmin.Note
This option does not work for text fields, if RTE is enabled.
-
- 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.The database field must allow the
NULLvalue.
'nullable' => true,
-
- Type
- string
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['placeholder']
- Scope
- Display
- Types
- input
Placeholder text for the field.
-
- 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 value but cannot edit it.
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
- string (keyword)
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['richtextConfiguration']
- Scope
- Display / Proc.
- RenderType
- default
The value is a key in
$GLOBALSarray and specifies the YAML configuration source field used for that RTE field. It does not make sense without having property enableRichtext set to true.['TYPO3_ CONF_ VARS'] ['RTE'] ['Presets'] Extension
rte_registers three presets:ckeditor default,minimalandfulland points to YAML files with configuration details.Integrators may override for instance the
defaultkey to point to an own YAML file which will affect all core backend RTE instances to use that configuration.If this property is not specified for an RTE field, the system will fall back to the
defaultconfiguration. The preset can be overridden with page TSconfig RTE.See also the rich text editor examples.
-
- Type
- integer
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['rows']
- Scope
- Display
- RenderType
- textTable, codeEditor, default
The number of rows in the textarea. May be corrected for harmonization between browsers. Will also automatically be increased if the content in the field is found to be of a certain length, thus the field will automatically fit the content. Default is 5. Max value is 20.
Does not apply to RTE fields.
The abstract of a talk
<?php
use MyVendor\MyExtension\Evaluation\AbstractEvaluation;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'abstract' => [
'label' => 'my_extension.db:talk.abstract',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 5,
'eval' => 'trim,' . AbstractEvaluation::class,
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'abstract',
'',
'before:--div--;core.form.tabs:access',
);
Changed in version 14.0 Breaking: #106976 - Removal of TCA search field configuration options
The following TCA field level search configuration options have been removed:
search.case search.pidonly search.and Where
They have not been supported by the Core or common Extensions.
-
- 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
textare considered searchable.To exclude a field from being searchable, set the following in the field's TCA configuration:
EXT:my_extension/Configuration/TCA/Overrides/132-tx_myextension_conference-embed_code.php<?php use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; defined('TYPO3') or die(); ExtensionManagementUtility::addTCAcolumns('tx_myextension_conference', [ 'embed_code' => [ 'label' => 'my_extension.db:conference.embed_code', 'config' => [ 'type' => 'text', 'renderType' => 'codeEditor', 'format' => 'html', 'rows' => 7, 'appearance' => [ 'lineWrapping' => true, ], 'behaviour' => [ 'allowLanguageSynchronization' => true, ], 'searchable' => false, ], ], ]); ExtensionManagementUtility::addToAllTCAtypes( 'tx_myextension_conference', 'embed_code', '', 'after:description', );
-
- Type
- string
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['softref']
- Scope
- Proc.
- Types
- input
Used to attach "soft reference parsers".
The syntax for this value is key1,key2[parameter1;parameter2;...],...
See Soft references of core API for more details about softref keys.
-
- 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 select box with prepared texts next to the field. When the editor selects an item, its value replaces the current text 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' => 'The prepared text.']. The label can be plain text or a label reference.
The organizers answer comments with a reply. A reply offers prepared
answers, a normal comment does not. Therefore the inline field reply
sets the value picker with
overrideChildTca:
The prepared answers of a reply
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_comment', [
'reply' => [
'label' => 'my_extension.db:comment.reply',
'config' => [
'type' => 'inline',
// The reply of the organizers is a comment, too. Its parent is the
// comment that it answers
'foreign_table' => 'tx_myextension_comment',
'foreign_field' => 'parent',
'foreign_table_field' => 'parent_table',
// The organizers answer a comment once
'relationship' => 'oneToOne',
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => 'name, content',
],
],
// Only a reply offers the prepared answers
'columns' => [
'content' => [
'config' => [
'valuePicker' => [
'items' => [
[
'label' => 'my_extension.db:comment.reply.thanks',
'value' => 'Thank you for your feedback.',
],
[
'label' => 'my_extension.db:comment.reply.recordings',
'value' => 'The recordings are online one week after the conference.',
],
],
],
],
],
],
],
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_comment',
'reply',
'',
'after:content',
);
-
- Type
- string (keyword)
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['wrap']
- Scope
- Display
- RenderType
- textTable, default
Determines the wrapping of the textarea field. Does not apply to RTE fields. There are two options:
- virtual (default)
- The textarea automatically wraps the lines like it would be expected for editing a text.
- off
- The textarea will not wrap the lines as you would expect when editing some kind of code.
Textarea with no wrapping
The requirements of a workshop without wrapping
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'requirements' => [
'label' => 'my_extension.db:talk.requirements',
'config' => [
'type' => 'text',
'rows' => 3,
'fixedFont' => true,
'enableTabulator' => true,
'wrap' => 'off',
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'requirements',
'workshop',
'before:--div--;core.form.tabs:access',
);
Textarea with virtual wrapping
'wrap' => 'virtual',