codeEditor (previously "t3editor")
Changed in version 13.0
In previous TYPO3 versions, the code editor was available via the system
extension
typo3/cms-t3editor
. The functionality was moved into
the system extension
typo3/cms-backend
. The render type
t3editor
was renamed to
code
.
A TCA migration from the old value to the new one is in place. See also Migration from render type t3editor to render type codeEditor.
This page describes the text type with the
render
.
The render
triggers a code highlighter.
The according database field is generated automatically.
The code editor provides an enhanced textarea for TypoScript input, with not only syntax highlighting, but also autocomplete suggestions. Beyond that the code editor makes it possible to add syntax highlighting to textarea fields for several languages.
Table of contents
Example: Code highlighting with code editor
Properties of the TCA column type text
, render type codeEditor
behaviour
-
allowLanguageSynchronization
-
- Type
- boolean
- Default
- false
- 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
fieldControl
-
For details see fieldControl.
fieldInformation
-
For details see fieldInformation.
fieldWizard
-
defaultLanguageDifferences
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['defaultLanguageDifferences']
For details see defaultLanguageDifferences.
localizationStateSelector
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['localizationStateSelector']
For details see localizationStateSelector.
otherLanguageContent
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldWizard']['otherLanguageContent']
For details see otherLanguageContent.
format
format
-
- Type
- string (keyword)
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display
The value specifies the language the code editor should handle. Allowed values:
css
html
javascript
php
typoscript
xml
readOnly
-
- Type
- boolean
- 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.
rows
-
- Type
- integer
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display
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.
search
-
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['search']
- Scope
- Search
- Types
- input
Defines additional search-related options for a given field.
pidonly
-
- Type
- boolean
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['pidonly']
Searches in the column only if search happens on the single page, does not search the field if searching in the whole table.
case
-
- Type
- boolean
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['case']
Makes the search case-sensitive. This requires a proper database collation for the field, see your database documentation.
andWhere
-
- Type
- string
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['search']['andWhere']
Additional SQL WHERE statement without 'AND'. With this it is possible to place an additional condition on the field when it is searched
<?php $textT3editorField = [ 'config' => [ 'type' => 'text', 'renderType' => 't3editor', 'behaviour' => [ 'allowLanguageSynchronization' => true, ], ], ];
This means that the "my_editor" field of the "tx_mytable" table will be searched in only for elements of type X and Y. This helps making any search more relevant.
The above example uses the special field quoting syntax
{#...}
around identifiers to be as DBAL compatible as possible.
softref
-
- Type
- string
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- 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.
Migration from render type t3editor
to render type codeEditor
The migration from render type t3editor
to render type code
is pretty
straight forward: Replace the render type. All other properties stayed the same.