codeEditor (previously "t3editor")

Changed in version 13.0

This page describes the text type with the renderType='codeEditor'.

The renderType='codeEditor' 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.

Example: Code highlighting with code editor

Code editor with highlighting HTML

Code editor with highlighting HTML

EXT:my_extension/Configuration/TCA/Overrides/tx_myextension_domain_model_mytable.php
<?php

$temporaryColumns['my_editor'] = [
    'label' => 'My HTML Editor',
    'description' => 'field description',
    'config' => [
        'type' => 'text',
        'renderType' => 'codeEditor',
        'format' => 'html',
        'rows' => 7,
    ],
];
Copied!

Properties of the TCA column type text, render type codeEditor

Name Type Scope
boolean Proc.
array
array
array
string (keyword) Display
boolean Display
integer Display
array Search
boolean
boolean
string
string Proc.

behaviour

behaviour

allowLanguageSynchronization

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_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/someTable.php
<?php

$textT3editorField = [
    'config' => [
        'type' => 'text',
        'renderType' => 't3editor',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

fieldControl

fieldControl

For details see fieldControl.

fieldInformation

fieldInformation

For details see fieldInformation.

fieldWizard

fieldWizard

defaultLanguageDifferences

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

For details see defaultLanguageDifferences.

localizationStateSelector

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

For details see localizationStateSelector.

otherLanguageContent

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

For details see otherLanguageContent.

format

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

See also Example: Code highlighting with code editor.

readOnly

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.

rows

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

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

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

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

EXT:my_extension/Configuration/TCA/Overrides/someTable.php
<?php

$textT3editorField = [
    'config' => [
        'type' => 'text',
        'renderType' => 't3editor',
        'behaviour' => [
            'allowLanguageSynchronization' => true,
        ],
    ],
];
Copied!

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

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 codeEditor is pretty straight forward: Replace the render type. All other properties stayed the same.


  $temporaryColumns['my_editor'] = [
      'label' => 'My HTML Editor',
      'description' => 'field description',
      'config' => [
          'type' => 'text',
-         'renderType' => 't3editor',
+         'renderType' => 'codeEditor',
          'format' => 'html',
          'rows' => 7,
      ],
  ];
Copied!