The "ctrl" section contains properties for the table in general.
These properties are basically divided into two main categories:
properties which affect how the table is displayed and handled in the backend interface . This includes which icon, what name, which columns contains the title value, which column defines the type value etc.
properties which determines how it is processed by the system (TCE).This includes publishing control, "deleted" flag, if the table can only be edited by admin-users, may only exist in the tree root etc.
Reference for the ['ctrl'] section:
Key | Datatype | Description | Scope |
|---|---|---|---|
title | string (LS) | Contains the system name of the table. Is used for display in the backend. For instance the "tt_content" table is of course named "tt_content" technically. However in the backend display it will be shown as "Pagecontent" when the backend language is english. When another language is chosen, like Danish, then the label "Sideindhold" is shown instead. This value is managed by the "title" value. You can insert plain text values, you can also add values for many languages by the obsolete concept of "language-splitting" (where you separate each language label by a vertical bar, "|") but please don't! In modern times it is always recommended to put the label values into an external file/array (local_lang files) and let the "title" field contain a reference to that value. See the example below. You should also have a look at the localization section in "Inside TYPO3" Example: $TCA['static_template'] = Array ( 'ctrl' => Array ( 'label' => 'title', 'tstamp' => 'tstamp', 'title' => 'LLL:EXT:cms/locallang_tca.php:static_template', In the above example the "LLL:" prefix tells the system to look up a label from the localization engine. The next prefix "EXT:cms" will look for the data source in the extension with the key "cms". In that extension the file "locallang_tca.php" will contain a $LOCAL_LANG array inside of which the label key "static_template" should contain the value, one for each language TYPO3 offers. | Display |
label | string (fieldname) | Required! Points to the fieldname of the table which should be used as the "title" when the record is displayed in the system. | Display |
label_alt | string | Commalist of fieldnames, which are holding alternative values to the value from the field pointed to by "label" (see above) if that value is empty. May not be used consistently in the system, but should apply in most cases. Example: $TCA['tt_content'] = Array ( 'ctrl' => Array ( 'label' => 'header', 'label_alt' => 'subheader,bodytext', See t3lib_BEfunc::getRecordTitle() Also see "label_alt_force" | Display |
label_alt_force | boolean | If set, then the "label_alt" fields are always shown in the title separated by comma. See t3lib_BEfunc::getRecordTitle() | Display |
type | string (fieldname) | Fieldname, which defines the "record type". The value of this field determines which one of the 'types' configurations are used for displaying the fields in the TCEforms. It will probably also affect how the record is used in the context where it belongs. The most widely known usage of this feature is the Content Elements where the "Type:" selector is defined as the "type" field and when you change that selector you will also get another rendering of the form:
It is also used by the "doktype" field in the "pages" table. Example: Here we will create an imaginary example to explain what the "type" property does. Imagine a table with four user editable fields:
We want the form in the backend to display only the fields "title" and "description" when the "displaytype" selector has the value "1" ("Regular display"). When the selector is set to value "2" ("Regular display + link") we want the form to show all three fields. This is done by first setting the "displaytype" field as the type field in [ctrl] section: script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'type' => 'displaytype',Then in the "types" section of the $TCA configuration (see later) we set up the fields for display: 'types' => Array ( '1' => Array('showitem' => 'title, description'), '2' => Array('showitem' => 'title, description, title_link') ) The backend will select the "showitem" list for ...["types"][2] when the field "displaytype" contains the value two. And likewise when "displaytype" is 1, then the first list is used to display fields in the backend. | Display / Proc. |
requestUpdate | string (list of fieldnames) | This is a list of fields additional to the type field which will request the user to update the form due to some content having change and which til affect the layout. For example you could add any of the subtype fields you might have configured. | Proc. |
iconfile | string | Pointing to the icon file to use for the table. Icons should be dimensioned 18x16 pixels (the last two right-most pixel columns in the width should preferably be empty) and of the GIF or PNG file type. The value of the option can be any of these:
Example: How to assign an icon from an extension In the ext_tables.php files of your extension you normally define the "ctrl" section of the tables you have added to the system. Here you can add a local icon from the extension like this: $TCA["tx_mininews_news"] = Array ( "ctrl" => Array ( "iconfile" => t3lib_extMgm::extRelPath($_EXTKEY)."icon_tx_mininews_news.gif", | Display |
typeicon_column | string (fieldname) | Fieldname, whose value decides alternative icons for the table (The default icon is the one defined with the 'iconfile' value.) An icon in the 'typeicons' array may override the default icon if an entry is found for the key having the value of the field pointed to by "typeicon_column" (this feature). Notice: These options ("typoicon_column" and "typeicons") does not work for the pages-table, which is configured by the PAGES_TYPES array. Related "typeicons" This feature is used by for instance the "tt_content" table (Content Elements) where each type of content element has its own icon. Example: See "typeicons" | Display |
typeicons | array | (See "typeicon_column") Example of configuration (from the "tt_content" table): 'typeicon_column' => 'CType', 'typeicons' => Array ( 'header' => 'tt_content_header.gif', 'textpic' => 'tt_content_textpic.gif', 'image' => 'tt_content_image.gif', 'bullets' => 'tt_content_bullets.gif', 'table' => 'tt_content_table.gif', 'splash' => 'tt_content_news.gif', 'uploads' => 'tt_content_uploads.gif', 'multimedia' => 'tt_content_mm.gif', 'menu' => 'tt_content_menu.gif', 'list' => 'tt_content_list.gif', 'mailform' => 'tt_content_form.gif', 'search' => 'tt_content_search.gif', 'login' => 'tt_content_login.gif', 'shortcut' => 'tt_content_shortcut.gif', 'script' => 'tt_content_script.gif', 'div' => 'tt_content_div.gif', 'html' => 'tt_content_html.gif' ), | Display |
thumbnail | string (fieldname) | Fieldname, which contains the value for any thumbnails of the records . This could be a type of the "group" type containing a list of file names. Example: For the "tt_content" table this option points to the field "image" which contains the list of images that can be attached to the content element: script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'thumbnail' => 'image',The effect of the field can be see in listings in eg. the "List" module:
(You might have to enable "Show Thumbnails by default" in the Setup module first to see this display). | Display |
selicon_field | string (fieldname) | Fieldname, which contains the thumbnail image used to represent the record visually whereever it is shown in TCEforms as a foreign reference selectable from a selectorbox. Only images of the ordinary webformat, like gif,png,jpeg,jpg, is allowed. No scaling is done. You should consider this a feature where you can attach an "icon" to a record which is typically selected as a reference in other records. For example a "category". In such a case this field points out the icon image which will then be shown. This feature can thus enrich the visual experience of selecting the relation in other forms. The feature is seldomly used. Related: "selicon_field_path" | Display |
selicon_field_path | string | The path prefix of the value from 'selicon_field'. This must be similar to the upload_path of that field (and thereby redundant). | Display |
sortby | string (fieldname) | Fieldname, which is used to manage the order the records. The field will contain an integer value which positions it at the correct position between other records from the same table on the current page. NOTICE: The field should not be editable by the user since the TCE will manage the content automatically in order to manage the order of records. This feature is used by eg. the "pages" table and "tt_content" table (Content Elements) in order to control the manually determined listing order of those records. Typically the fieldname "sorting" is dedicated to this feature. Related: "default_sortby" | Display/Proc. |
default_sortby | string | If a fieldname for "sortby" is defined, then this is ignored. Otherwise this is used as the 'ORDER BY' statement to sort the records in the table when listed in TBE. A few examples: "default_sortby" => "ORDER BY title", "default_sortby" => "ORDER BY tstamp DESC", "default_sortby" => "ORDER BY parent,crdate DESC", | Display |
mainpalette | comma seperated list of integers (pointing to multiple palette keys) | Points to the palette-number(s) that should always be shown in the bottom of the TCEform. Example: For many records you can find the last section of the form looking something like this:
This box displays the fields from the "main palette". In the case above (table: "tt_content") the main palette is "1" configured like this in $TCA for "tt_content": 'palettes' => Array ( '1' => Array('showitem' => 'hidden,starttime,endtime,fe_group'),And in the "ctrl" section it looks like this: 'mainpalette' => '1', | Display |
canNotCollapse | boolean | If set, then the "Show secondary options" check box will not affect this table - no matter what, all fields and palettes are displayed in the main form at all times. Just like if the check box was always set.
| Display |
tstamp | string (fieldname) | Fieldname, which is automatically updated to the current timestamp (UNIX-time in seconds) each time the record is updated/saved in the system. Typically the field name "tstamp" is used for the time stamp value. Example: This example shows the configuration for the "fe_users" table and how the tstamp, crdate and cruser_id fields have been configured: $TCA['fe_users'] = Array ( 'ctrl' => Array ( 'label' => 'username', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', | Proc. |
crdate | string (fieldname) | Fieldname, which is automatically set to the current timestamp when the record is created. Is never modified again. Typically the field name "crdate" is used for the time stamp value. | Proc. |
cruser_id | string (fieldname) | Fieldname, which is automatically set to the uid of the backend user (be_users) who originally created the record. Is never modified again. Typically the field name "cruser_id" is used for the time stamp value. | Proc. |
rootLevel | [0, 1, -1] | Determines where a record may exist in the page tree. There are three options depending on the value:
Notice: The setting for "rootLevel" is ignored for records in the "pages" table (they are hardcoded to be allowed anywhere, equal to a "-1" setting of rootLevel) | Proc. / Display |
readOnly | boolean | Records may not be changed. This makes a table "static". In TYPO3 the most wellknown static table is "static_template" which contains pre-configured TypoScript code snippets. But you can also find a number of extensions which contains static table information like zip-codes, airport codes, country, currency codes etc. | Proc. / Display |
adminOnly | boolean | Records may be changed only by "admin"-users (having the "admin" flag set). Examples from the "cms" extension are the tables "sys_template" and "static_template" (the latter is also "readOnly"). | Proc. / Display |
editlock | string (fieldname) | Fieldname, which – if set – will prevent all editing of the record for non-admin users. The field should be configured as a checkbox type. Non-admins could be allowed to edit the checkbox but if they set it, they will effectively lock the record so they cannot edit it again – and they need an Admin-user to remove the lock. If this feature is used on the pages table it will also prevent editing of records on that page (except other pages)! Also, no new records (including pages) can be created on the page. This flag is cleared when a new copy or version of the record is created. | Proc / Display |
origUid | string (fieldname) | Fieldname, which will contain the UID of the original record in case a record is created as a copy or new version of another record. Is used when new versions are created from elements and enables the backend to display a visual comparison between a new version and its original. | Proc |
delete | string (fieldname) | Fieldname, which indicates if a record is considered deleted or not. If this feature is used, then records are not really deleted, but just marked 'deleted' by setting the value of the fieldname to "1". And in turn the whole system must strictly respect the record as deleted. This means that any SQL query must exclude records where this field is true. This is a very common feature. | Proc. / Display |
enablecolumns | array | Specifies which publishing control features are automatically implemented for the table. This includes that records can be "disabled" or "hidden", have a starting and/or ending time and be access controlled so only a certain front end user group can access them In the frontend libraries the enableFields() function automatically detects which of these fields are configured for a table and returns the proper WHERE clause SQL code for creating select queries. There are the keys in the array you can use. Each of the values must be a field name in the table which should be used for the feature: "disabled": defining hidden-field of record "starttime": defining starttime-field of record "endtime": defining endtime-field of record "fe_group": defining fe_group-field of record Notice: In general these fields does not affect the access or display in the backend! They are primarily related to the frontend. However the icon of records having these features enabled will normally change as these examples show: [INSERT IMAGE] See also the "delete" feature which is related, but is active for both frontend and backend. Example: Typically the "enablecolumns" could be configured like this (here for the "tt_content" table): 'enablecolumns' => Array ( 'disabled' => 'hidden', 'starttime' => 'starttime', 'endtime' => 'endtime', 'fe_group' => 'fe_group', ), | Proc. / Display |
hideAtCopy | boolean | If set, and the "disabled" field from "enablecolumns" (see below) is specified, then records will be disabled/hidden when they are copied. | Proc. |
prependAtCopy | string (LS) | This string will be prepended the records title field when the record is inserted on the same PID as the original record (thus you can distinguish them). Usually the value is something like " (copy %s)" which tells that it was a copy that was just inserted (The token "%s" will take the copy number). | Proc. |
copyAfterDuplFields | string (list of fieldnames) | The fields in this list will automatically have the value of the same field from the 'previous' record transferred when they are copied or moved to the position after another record from same table. Example: script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'copyAfterDuplFields' => 'colPos,sys_language_uid', | Proc. |
setToDefaultOnCopy | string (list of fieldnames) | These fields are restored to the default value of the record when they are copied. Example: $TCA["sys_action"] = Array ( "ctrl" => Array ( "setToDefaultOnCopy" => "assign_to_groups", | Proc. |
useColumnsForDefaultValues | string (list of fieldnames) | When a new record is created, this defines the fields from the 'previous' record that should be used as default values. Example: $TCA['sys_filemounts'] = Array ( 'ctrl' => Array ( 'useColumnsForDefaultValues' => 'path,base', | Proc. |
shadowColumnsForNewPlaceholders | string (list of fieldnames) | When a new element is created in a draft workspace a placeholder element is created in the Live workspace. Certain values of the draft element can be necessary to transfer to the live element, such as sys_language_uid typically. This list of fields will define which values are "shadowed" to the Live record. Example: $TCA['tt_content'] = Array ( 'ctrl' => Array ( 'shadowColumnsForNewPlaceholders' => 'sys_language_uid,l18n_parent,colPos', | |
is_static | boolean | This marks a table to be "static". A "static table" means that it should not be updated for individual databases because it is meant to be centrally updated and distributed. For instance static tables could contain country-codes used in many systems. The foremost property of a static table is that the uid's used are the SAME across systems. Import/Export of records expect static records to be common for two systems. Example (also including the features "rootLevel", "readOnly" and "adminOnly" above): $TCA['static_template'] = Array ( 'ctrl' => Array ( 'label' => 'title', 'tstamp' => 'tstamp', 'title' => 'LLL:EXT:cms/locallang_tca.php:static_template', 'readOnly' => 1, // Prevents the table from being altered 'adminOnly' => 1, // Only admin, if any 'rootLevel' => 1, 'is_static' => 1, | Used by import/export |
fe_cruser_id | string (fieldname) | Fieldname, which is used to store the uid of a front-end user if he is created the record through fe_adminLib | FE |
fe_crgroup_id | string (fieldname) | Fieldname, which is used for storing the uid of a fe_group record, where the members of that record are allowed to edit through fe_adminLib . | FE |
fe_admin_lock | string (fieldname) | Fieldname, which points to the fieldname which - as a boolean - will prevent any editing by the fe_adminLib, if set. Say if the "fe_cruser_id" field matches the current fe_user normally the field is editable. But with this option, you could make a check-box in the backend that would lock this option. | FE |
languageField | string (fieldname) | Localization access control. Fieldname, which contains the pointer to the language of the records content. Languages for a record is defined by an integer pointing to a “sys_language” record (found in the page tree root). Backend users can be limited to have edit access for only certain of these languages and if this option is set, edit access for languages will be enforced for this table. Pointers to a language has this value range: -1 : (ALL) The record does not represent any specific language. Localization access control is never carried out for such a record. Typically this is used if the record has content (such as flexforms in itself containing the localization or a plugin with general purpose) which internally contain localized values – hence making such a flag for the container record futile. 0 : The default language of the system. Localization access control applies. Values > 0 : Points to a uid of a sys_language record representing a possible language for translation. Localization access control applies. The fieldname pointed to should be a single value selector box (maxitems <=1) saving its value into an integer field in the database. | Proc / Display |
transOrigPointerField | string (fieldname) | Fieldname, which contains the uid of the record which this record is a translation of. If this value is found being set together with “languageField” then TCEforms will show the default translation value under the fields in the main form. This is very neat if translators are to see what they are translating of course... Must be configured in “columns”, at least as a passthrough type. | Proc / Display |
transOrigPointerTable | string (tablename) | Optional table name for the table where record uids in “transOrigPointerField” comes from. This is needed in very rare applications where the original language is found in another table of the database. In such cases the field names must match between the tables. An example of this is the pages table and “pages_language_overlay”. | Proc / Display |
transOrigDiffSourceField | string (fieldname) | Fieldname which will be updated with the value of the original language record whenever the translation record is updated. This information is later used to compare the current values of the default record with those stored in this field and if they differ there will be a display in the form of the difference visually. This is a big help for translators so they can quickly grasp the changes that happened to the default language text. The field type in the database should be a large text field (clob/blob). You don't have to configure this field in the “columns” section of TCA, but if you do, select the “passthrough” type. That will enable that the undo function also works on this field. | Proc / Display |
versioningWS | boolean / keyword | If set, versioning is enabled for this table. Versioning in TYPO3 is based on this scheme: [Online version, pid>=0] 1- * [Offline versions, pid=-1] Offline versions are identified by having a pid value = -1 and they refer to their online version by the field “t3ver_oid”. In the backend “Offline” is labeled “Draft” while “Online” is labeled “Live”. In order for versioning to work on a table there are certain requirements; Tables supporting versioning must have these fields:
SQL definitions: t3ver_oid int(11) DEFAULT '0' NOT NULL, t3ver_id int(11) DEFAULT '0' NOT NULL, t3ver_wsid int(11) DEFAULT '0' NOT NULL, t3ver_label varchar(30) DEFAULT '' NOT NULL, t3ver_state tinyint(4) DEFAULT '0' NOT NULL, t3ver_stage tinyint(4) DEFAULT '0' NOT NULL, t3ver_count int(11) DEFAULT '0' NOT NULL, t3ver_tstamp int(11) DEFAULT '0' NOT NULL, Special “t3ver_swapmode” field for pages When pages are versioned it is an option whether content and even the branch of the page is versioned. This is determined by the parameter “treeLevels” set when the page is versioned. “-1” means swap only record, 0 means record and content and >0 means full branch. When the version is later published the swapping will happen accordingly. | Proc. |
versioning_followPages | boolean | (Only for other tables than “pages”) If set, content from this table will get copied along when a new version of a page is created. Tracking Originals It is highly recommended to use the “origUid” feature for tables whose records are copied with pages that are versioned with content or subtree since this will enable the possibility of content comparison between current and future versions. | Proc. |
versioning | [OBSOLETE] | In version 3.7 and 3.8 this was used to activate versioning for a table. However large changes in the API made it easier to simply disable this feature and introduce “versioningWS”. Migration: The migration is very easy: Simply set “versioningWS” instead of “versioning” for your table AND upgrade the SQL fields as defined for “versioningWS”! | |
dividers2tabs | boolean | If set, all “--div--” fieldnames in the types configuration will be interpreted as starting a new tab in a tab-menu for the record. The second part after “--div--” will be the title of the tab then. If you place a “--div--” field as the very first element in the types configuration it will just be used to set the title of the first tab (which is by default “General”). If you like to place the main palette on its own tab in the end, simply add “--div--” as the very last field. Example: A types configuration for a table looks like this: "types" => Array ( "0" => Array("showitem" => "--div--;Basis valg, hidden;;1;;1-1-1, title;;;;2-2-2, type;;;;3-3-3, template, --div--;Frekvens, freq, time1, time2, time3, time4, time5, time6, time7, time8, --div--;Details, sourceurl, inputparser, position, dailysubpage, newpageishidden, notify_on_creation_email, logimportsonly") ), This will render a tab menu for the record where the fields are distributed on the various pads:
Here another tab is activated and another part of the form is shown:
| |
dynamicConfigFile | string | Reference to the complete $TCA entry content. Filename of the PHP file which contains the full configuration of the table in $TCA. The [ctrl] part (and [feInterface] if used) are always mandatory, but the rest may be placed in such a file in order to limit the amount of memory consumed by the $TCA array (when eg. the columns definitions are not needed). The format of the value is as follows:
Example: This is the typical configuration in an extension where the file named "tbl.php" contains all configuration for the "columns", "types" and "palettes": $TCA["tx_mininews_news"] = Array ( "ctrl" => Array ( "dynamicConfigFile" => t3lib_extMgm::extPath($_EXTKEY)."tca.php", ), "feInterface" => Array ( "fe_admin_fieldList" => "hidden, starttime, front_page", ) ); In the file "tca.php" in the extension you will find this PHP code which completes the $TCA entry for the table: <?php if (!defined ("TYPO3_MODE")) die ("Access denied."); $TCA["tx_mininews_news"] = Array ( "ctrl" => $TCA["tx_mininews_news"]["ctrl"], "interface" => Array ( "showRecordFieldList" => "hidden,starttime,front_page" ), "feInterface" => $TCA["tx_mininews_news"]["feInterface"], "columns" => Array ( "hidden" => Array ( "exclude" => 1, "label" => $LANG_GENERAL_LABELS["hidden"], "config" => Array ( "type" => "check", "default" => "0" ) ), ... etc | API |
EXT[extension_key] | array | User defined content for extensions. You can use this as you like. Lets say you have an extension with the key "myext", then you have the right to define properties for: ...['ctrl']['EXT']['myext'] = ... (whatever you define) | Ext. |
Examples
Here are a few examples of configurations of the control section.
1: $TCA['pages'] = Array (
2: 'ctrl' => Array (
3: 'label' => 'title',
4: 'tstamp' => 'tstamp',
5: 'sortby' => 'sorting',
6: 'title' => 'LLL:EXT:lang/locallang_tca.php:pages',
7: 'type' => 'doktype',
8: 'delete' => 'deleted',
9: 'crdate' => 'crdate',
10: 'hideAtCopy' => 1,
11: 'prependAtCopy' => 'LLL:EXT:lang/locallang_general.php:LGL.prependAtCopy',
12: 'cruser_id' => 'cruser_id',
13: 'useColumnsForDefaultValues' => 'doktype'
14: ),
The pages table has the configuration you see above (found in t3lib/stddb/tables.php). Here are a few notes:
Line 3: When pages are displayed in the backend you will see the content from the field named "title" shown as the title of the page record.
Line 5: This configures the field "sorting" as the field which determines the order in which pages are displayed within each branch of the page tree.
Line 6: The title for the pages table as shown in the backend (eg. "Pages" in english, "Sider" in danish etc...) is defined here to come from a "locallang" file.
Line 7: Defines which field will be the "type" field. This determines the set of fields shown in the edit forms in the backend.
Line 10: Defines that pages should be hidden when copied.
The tt_content table (Content Elements) looks like this in the "ctrl" section (sysext/cms/ext_tables.php):
1: // ******************************************************************
2: // This is the standard TypoScript content table, tt_content
3: // ******************************************************************
4: $TCA['tt_content'] = Array (
5: 'ctrl' => Array (
6: 'label' => 'header',
7: 'label_alt' => 'subheader,bodytext',
8: 'sortby' => 'sorting',
9: 'tstamp' => 'tstamp',
10: 'title' => 'LLL:EXT:cms/locallang_tca.php:tt_content',
11: 'delete' => 'deleted',
12: 'type' => 'CType',
13: 'prependAtCopy' => 'LLL:EXT:lang/locallang_general.php:LGL.prependAtCopy',
14: 'copyAfterDuplFields' => 'colPos,sys_language_uid',
15: 'useColumnsForDefaultValues' => 'colPos,sys_language_uid',
16: 'enablecolumns' => Array (
17: 'disabled' => 'hidden',
18: 'starttime' => 'starttime',
19: 'endtime' => 'endtime',
20: 'fe_group' => 'fe_group',
21: ),
22: 'typeicon_column' => 'CType',
23: 'typeicons' => Array (
24: 'header' => 'tt_content_header.gif',
25: 'textpic' => 'tt_content_textpic.gif',
26: 'image' => 'tt_content_image.gif',
27: 'bullets' => 'tt_content_bullets.gif',
28: 'table' => 'tt_content_table.gif',
29: 'splash' => 'tt_content_news.gif',
30: 'uploads' => 'tt_content_uploads.gif',
31: 'multimedia' => 'tt_content_mm.gif',
32: 'menu' => 'tt_content_menu.gif',
33: 'list' => 'tt_content_list.gif',
34: 'mailform' => 'tt_content_form.gif',
35: 'search' => 'tt_content_search.gif',
36: 'login' => 'tt_content_login.gif',
37: 'shortcut' => 'tt_content_shortcut.gif',
38: 'script' => 'tt_content_script.gif',
39: 'div' => 'tt_content_div.gif',
40: 'html' => 'tt_content_html.gif'
41: ),
42: 'mainpalette' => '1',
43: 'thumbnail' => 'image',
44: 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tbl_tt_content.php'
45: )
46: );
Line 7: Here additional fields are defined to be used if no content is found in the "header" field (defined in line 6)
Line 16-21: The "enablecolumns" section is extensive for this table since it is a front end related table. Typically they use the "enablecolumns" a lot.
Line 22-41: For each content element type a new icon is defined. This helps the users to easily recognize which type of content element they are looking at when they see the element in a list of records.
Line 43: The column "image" is used to fetch any thumbnails there are to show for the record.
Contains configuration for display and listing in various parts of the core backend:
Key | Datatype | Description |
|---|---|---|
showRecordFieldList | string (list of fieldnames) | Defines which fields are shown in the show-item dialog. Eg. 'doktype,title,alias,hidden,....' |
always_description | boolean | If set, the description/helpicons are always shown regardless of the configuration of the user. Works only in TCEforms and for tables loaded via t3lib_BEfunc::loadSingleTableDescription()
|
maxDBListItems | integer | Max number of items shown in the List module |
maxSingleDBListItems | integer | Max number of items shown in the List module, if this table is listed in Extended mode (listing only a single table) |
Example
This is how the "pages" table is configured for these settings (in t3lib/stddb/tables.php):
'interface' => Array (
'showRecordFieldList' => 'doktype,title',
'maxDBListItems' => 30,
'maxSingleDBListItems' => 50
),
The "feInterface" section contains properties related to Front End Editing of the table, mostly related to the feAdmin_lib.
Is depricated in the sense that it will still exist, but will not be (and should not be) extended further.
Key | Datatype | Description |
|---|---|---|
editableRecordFields | string (list of fieldnames) | List of fields, example: '*name, *type, biography, filmography'. Used for front-end edit module created by Rene Fritz <r.fritz@colorcube.de> |
fe_admin_fieldList | string (list of fieldnames) | List of fields allowed for editing/creation with the fe_adminLib module, see media/scripts/fe_adminLib, example: 'pid,name,title,address' |
The "columns" section contains configuration for each table field (also called "column") which can be edited by the backend.
The configuration includes both properties for the display in the backend as well as the processing of the submitted data.
Each field can be configured as a certain "type" (eg. checkbox, selector, iinput field, text area, file or db-relation field, user defined etc.) and for each type a separate set of additional properties applies. These properties are clearly explained below for each type.
This table showns the keys of the ['columns'][fieldname] array:
Key | Datatype | Description | Scope |
|---|---|---|---|
label | string (LS) | Required! The name of the field as it is shown in the interface:
| Display |
exclude | boolean | If set, all backend users are prevented from editing the field unless they are members of a backend usergroup with this field added as an "Allowed Excludfield" (or "admin" user). | Proc. |
l10n_mode | string (keyword) | Localization mode. Only active if the ctrl-directive “languageField” is set. The main relevance is when a record is localized by an API call in tcemain that makes a copy of the default language record. You can think of this process as copying all fields from the source record, except if a special mode applies as defined below: Keywords are:
(Doesn't apply to flexform fields.) | Display / Proc. |
l10n_display | list of keywords | Localization display. see: l10n_mode This option can be used to define the language related field rendering. This has nothing to do with the processing of language overlays and data storage but the display of form fields. Keywords are:
| Display |
l10n_cat | string (keyword) | Localization category. Keywords: text,media When localization mode is set for a TCEforms, it must be either of these values. Only the fields that have l10n_cat set to the localization mode is show. Used to limit display so only most relevant fields are shown to translators. It doesn't prevent editing of other fields if records are edited outside localization mode, it merely works as a display condition. It is also used in localization export (pending at this moment). | Display |
config | array | Contains the actual configuration properties of the fields display and processing behaviour. The possibilities for this array depend on the value of the array key "type" within the array. Each valid value for "type" is shown below in a separate table. Notice: For all configuration types, the
| - |
displayCond | string | Contains a condition rule for whether to display the field or not. A rule is a string divided into several parts by ":" (colons). The first part is the rule-type and the subsequent parts will depend on the rule type. Currently these rule values can be used:
For FlexForm elements the fields are tags on same level. If <langChildren> is enabled, then the value of other fields on same level is taken from the same language. Example: This example will require the field named "tx_templavoila_ds" to be true, otherwise the field for which this rule is set will not be displayed: 'displayCond' => 'FIELD:tx_templavoila_ds:REQ:true', This example requires the extension "static_info_tables" to be loaded, otherwise the field is not displayed. (This is useful if the field makes a look-up on a table coming from another extension!) 'displayCond' => 'EXT:static_info_tables:LOADED:true', | Display |
defaultExtras | string | In the “types” configuration of a field you can specify on position 4 a string of "extra configuration". This string will be the default string of extra options for a field regardless of types configuration. For instance this can be used to create an RTE field without having to worry about special configuration in “types” config. This is also the way by which you can enable the RTE for FlexForm fields. Example value: richtext[cut|copy|paste|formatblock|textcolor|bold|italic|underline|left|center|right|orderedlist|unorderedlist|outdent|indent|link|table|image|line|chMode]:rte_transform[mode=ts_css|imgpath=uploads/tx_mininews/rte/] |
The type "input" generates an <input> field, possibly with additional features applied.
Key | Datatype | Description | Scope |
|---|---|---|---|
type | string | [Must be set to "input"] | Display / Proc. |
size | integer | Abstract value for the width of the <input> field. To set the input field to the full width of the form area, use the value 48. Default is 30. | Display |
max | integer | Value for the "maxlength" attribute of the <input> field. If the form element edits a varchar(40) field in the database you should also set this value to 40. | Display |
default | string | The default value | Display / Proc. |
eval | list of keywords | 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 eval-functions will be executed in the list-order. Keywords:
All the above evaluations (unless noted) are done by JavaScript with the functions found in the script t3lib/jsfunc.evalfield.js "(TCE)" means the evaluation is done in the TCE on the server. The class used for this is t3lib_TCEmain. Example: Setting the field to evaluate the input to a date returned to the database in UNIX-time (seconds) 'eval' => 'date', Trimming the value for white space before storing in the database (important for varchar fields!) 'eval' => 'trim', By this configuration the field will be stripped for any space characters, converted to lowercase, only accepted if filled in and on the server the value is required to be unique for all records from this table: 'eval' => 'nospace,lower,unique,required' User defined form evaluations: You can supply your own form evaluations in an extension by creating a class with two functions, one which returns the JavaScript code for client side validation called returnFieldJS() and one which does the server side validation called evaluateFieldValue(). The function evaluateFieldValue() has 3 arguments:
Example: class.tx_exampleextraevaluations_extraeval1.php: <?php class tx_exampleextraevaluations_extraeval1 {function returnFieldJS() {return ' return value + " [added by JS]"; '; } function evaluateFieldValue($value, $is_in, &$set) {return $value.' [added by PHP]'; } } ?> ext_localconf.php <?php // here we register "tx_exampleextraevaluations_extraeval1" $TYPO3_CONF_VARS['SC_OPTIONS']['tce']['formevals']['tx_exampleextraevaluations_extraeval1'] = 'EXT:example_extraevaluations/ class.tx_exampleextraevaluations_extraeval1.php'; ?> Feel free to download the example extension as a T3X file. | Display / Proc. |
is_in | string | If the evaluation type "is_in" (see above, under key "eval") is used for evaluation, then the characters in the input string should be found in this string as well. | Display / Proc. |
checkbox | string | If defined (even empty), a checkbox is placed before the input field. If a value other than the value of 'checkbox' (this value) appears in the input-field the checkbox is checked. Example: 'checkbox' => '123', If you set this value then entering "12345" in the field will render this:
But if you either uncheck the checkbox or just enter the value "123" you will an empty input field and no checkbox set - however the value of the field will be "123":
This feature is useful for date-fields for instance. In such cases the checkbox will allow people to quickly remove the date setting (equal to setting the date to zero which actually means 1-1 1970 or something like that). Example listing: script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'config' => Array ('type' => 'input', 'size' => '8', 'max' => '20', 'eval' => 'date', 'checkbox' => '0', 'default' => '0' ) Will create a field like this below. Checking the checkbox will insert the date of the current day. Unchecking the checkbox will just remove the value and silently sent a zero to the server (since the value of the key "checkbox" is set to "0").
| Display / Proc. |
range | array | An array which defines an integer range within which the value must be. Keys: "lower": Defines the lower integer value. "upper": Defines the upper integer value. You can specify both or only one of them. Notice: This feature is evaluated on the server only so any regulation of the value will have happend after saving the form. Example: Limits an integer to be within the range 10 to 1000: script_ended = 0; function jumpToUrl(URL) { document.location = URL; } 'eval' => 'int', 'range' => array('lower' => 10,'upper' => 1000), In this example the upper limit is set to the last day in year 2020 while the lowest possible value is set to the date of yesterday. script_ended = 0; function jumpToUrl(URL) { document.location = URL; } 'range' => Array ( 'upper' => mktime(0,0,0,12,31,2020), 'lower' => mktime(0,0,0,date('m')-1,date('d'),date('Y')) ) | Proc. |
wizards | array | [See section later for options] | Display |
Now follows some codelistings as examples:
Example: A "date" field
This is the typical configuration for a date field, like "starttime":
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'starttime' => Array ('exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.starttime',
'config' => Array (
'type' => 'input',
'size' => '8',
'max' => '20',
'eval' => 'date',
'checkbox' => '0',
'default' => '0'
)
),
Example: A "username" field
In this example the field is for entering a username (from "fe_users"). A number of requirements are imposed onto the field, namely that it must be unique within the page where the record is stored, must be in lowercase and without spaces in it:
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'username' => Array ('label' => 'LLL:EXT:cms/locallang_tca.php:fe_users.username',
'config' => Array (
'type' => 'input',
'size' => '20',
'max' => '50',
'eval' => 'nospace,lower,uniqueInPid,required'
)
),
Example: A typical input field
This is just a very typical configuration which sets the size and a character limit to the field. In addition the input value is trimmed for surrounding whitespace which is a very good idea when you enter values into varchar fields.
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'name' => Array ('exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.name',
'config' => Array (
'type' => 'input',
'size' => '40',
'eval' => 'trim',
'max' => '80'
)
),
Example: Required values
Here the field is required to be filled in:
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'title' => Array ('label' => 'LLL:EXT:cms/locallang_tca.php:fe_groups.title',
'config' => Array (
'type' => 'input',
'size' => '20',
'max' => '20',
'eval' => 'trim,required'
)
),
This field type generates a <textarea> field or inserts a RTE (Rich Text Editor).
Such a field looks like this:
Key | Datatype | Description | Scope |
|---|---|---|---|
type | string | [Must be set to "text"] | Display / Proc. |
cols | integer | Abstract value for the width of the <textarea> field. To set the textarea to the full width of the form area, use the value 48. Default is 30. | Display |
rows | integer | The number of rows in the textarea. May be corrected for harmonisation 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. | Display |
wrap | ["off", "virtual"] | Determines the wrapping of the textarea field. There are two options: "virtual": (Default) The textarea will automatically wrap 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. Notice: If the string "nowrap" is found among options in the fields extra configuration from the "types" listing this will override the setting here to "off". Example: This configuration will create a textarea useful for entry of code lines since it will not wrap the lines: "config" => Array ( "type" => "text", "cols" => "40", "rows" => "15", 'wrap' => 'off', ) | Display |
default | string | Default value | Display / Proc. |
wizards | array | [See section later for options] | Display |
Now follows some codelistings as examples:
Example: A quite normal field
This is the typical configuration for a textare field:
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'message' => Array ('label' => 'LLL:EXT:sys_note/locallang_tca.php:sys_note.message',
'config' => Array (
'type' => 'text',
'cols' => '40',
'rows' => '15'
)
),
This type creates checkbox(es). Such elements might look like this:
You can also configure checkboxes to appear in an array:
You can have between 1 and 10 checkboxes and the field type in the database must be an integer. No matter how many checkboxes you have each check box will correspond to a single bit in the integer value. Even if there is only one checkbox (which in turn means that you should theoretically check the bit-0 of values from single-checkbox fields and not just whether it is true or false!).
Key | Datatype | Description | Scope |
|---|---|---|---|
type | string | [Must be set to "check"] | Display / Proc. |
items | array | If set, this array will create an array of checkboxes instead of just a single "on/off" checkbox. Notice: You can have a maximum of 10 checkboxes in such an array and each element is represented by a single bit in the integer value which ultimately goes into the database. In this array each entry is itself an array where the first entry is the label (LS) and the second entry is a blank value. The value sent to the database will be an integer where each bit represents the state of a checkbox in this array. Example: 'items' => Array ( Array('Green tomatoes', ''), Array('Red peppers', '')), | Display |
cols | integer | How many columns the checkbox array are shown in. Range is 1-10, 1 being default. (Makes sense only if the 'array' key is defining a checkbox array) | Display |
showIfRTE | boolean | If set, this field will show only if the RTE editor is enabled (which includes correct browserversion and user-rights altogether.) | Display |
default | integer | Setting the default value of the checkbox(es). Notice: Each bit corresponds to a check box (even if only one checkbox which maps to bit-0). | Display / Proc. |
itemsProcFunc | string (function reference) | PHP function which is called to fill / manipulate the array with elements. The function/method will have an array of parameters passed to it (where the item-array is passed by reference in the key 'items'). By modifying the array of items, you alter the list of items. For more information, see how user-functions are specified in the section about 'wizards' some pages below here. | Display |
Now follows some codelistings as examples:
Example: A single checkbox
A totally unfancy checkbox:
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'personal' => Array ('label' => 'LLL:EXT:sys_note/locallang_tca.php:sys_note.personal',
'config' => Array (
'type' => 'check'
)
)
Example: A checkbox array
This is an example of a checkbox array with two checkboxes in it. The first checkbox will have bit-0 and the second bit-1. The default value is set to '3' which means that each checkbox will be enabled by default (since the value three contains both bit-0 and bit-1):
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'sendOptions' => Array ('label' => 'LLL:EXT:direct_mail/locallang_tca.php:sys_dmail.sendOptions',
'config' => Array (
'type' => 'check',
'items' => Array (
Array('LLL:EXT:direct_mail/locallang_tca.php:sys_dmail.sendOptions.I.0', ''), Array('LLL:EXT:direct_mail/locallang_tca.php:sys_dmail.sendOptions.I.1', '')),
'default' => '3'
)
),
Radio buttons are seldom used, but sometimes they can be more attractive than their more popular sisters (selector boxes).
Here you see radio buttons in action for the "Filemounts" records:
Key | Datatype | Description | Scope |
|---|---|---|---|
type | string | [Must be set to "radio"] | Display / Proc. |
items | array | Required. An array of the values which can be selected. Each entry is in itself an array where the first entry is the title (LS) and the second entry is the value of the radiobutton. See example below. | Display |
default | mixed | Default value. | Display / Proc. |
itemsProcFunc | string (function reference) | PHP function which is called to fill / manipulate the array with elements. The function/method will have an array of parameters passed to it (where the item-array is passed by reference in the key 'items'). By modifying the array of items, you alter the list of items. For more information, see how user-functions are specified in the section about 'wizards' some pages below here. | Display |
Example:
An example of radio buttons configuration from "sys_filemounts" (see above):
script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'base' => Array ('label' => 'BASE',
'config' => Array (
'type' => 'radio',
'items' => Array (
Array('absolute (root) / ', 0), Array('relative ../fileadmin/', 1)),
'default' => 0
)
)
Selectors boxes are very common elements in forms. By the "select" type you can create selector boxes. In the most simple form this is a list of values amoung which you can chose only one. In that way it is similar to the "radio" type above.
It is also possible to configure more complex types where the values from from a look up in another database table and you can even have a type where more than one value can be selected in any given order you like.
Key | Datatype | Description | Scope |
|---|---|---|---|
type | string | [Must be set to "select"] | Display / Proc. |
items | array | Contains the elements for the selector box unless the property "foreign_table" or "special" has been set in which case automated values are set in addition to any values listed in this array. Each element in this array is in itself an array where:
Example: A configuration could look like this: script_ended = 0;
function jumpToUrl(URL) {
document.location = URL;
}
'type' => 'select','items' => Array ( Array('English', ''), Array('Danish', 'dk'), Array('German', 'de'),) A more complex example could be this (includes icons): 'type' => 'select', 'items' => Array ( Array('LLL:EXT:cms/locallang_ttc.php:k1', 0, 'selicons/k1.gif'), Array('LLL:EXT:cms/locallang_ttc.php:k2', 1, 'selicons/k2.gif'), Array('LLL:EXT:cms/locallang_ttc.php:k3', 2, 'selicons/k3.gif'), ) | Display |
itemsProcFunc | string (function reference) | PHP function which is called to fill / manipulate the array with elements. The function/method will have an array of parameters passed to it (where the item-array is passed by reference in the key 'items'). By modifying the array of items, you alter the list of items. For more information, see how user-functions are specified in the section about 'wizards' some pages below here. | Display |
selicon_cols | integer (>0) | The number of rows in which to position the iconimages for the selectorbox. Default is to render as many columns as iconimages. | Display |
suppress_icons | string | Lets you disable display of icons. Can be nice to do if icons are coming from foreign database records and you don't want them. Set it to "IF_VALUE_FALSE" if you only want to see icons when a value (non-blank, non-zero) is selected. Otherwise no icons are shown. Set it to "ONLY_SELECTED" if you only want to see an icon for the selected item. Set to "1" (true) if you never want any icons. | Display |
iconsInOptionTags | boolean | If set, icons will appear in the <option> tags of the selector box. This feature seems only to work in Mozilla. | |
foreign_table | string (tablename) | The item-array will be filled with records from the table defined here. The table must be configured in $TCA. See the other related options below. | Proc. / Display |
foreign_table_where | string (SQL WHERE clause) | The items from "foreign_table" are selected with this WHERE-clause. The table is joined with the "pages"-table and items are selected only from pages where the user has read access! (Not checking DB mount limitations!) Example: AND [foreign_table].pid=0 ORDER BY [foreign_table].sorting Markers: You can use markers in the WHERE clause:
The markers are preprocessed so that the value of CURRENT_PID and PAGE_TSCONFIG_ID are always integers (default is zero), PAGE_TSCONFIG_IDLIST will always be a commalist of integers (default is zero) and PAGE_TSCONFIG_STR will be addslashes'ed before substitution (default is blank string). | Proc. / Display |
foreign_table_prefix | string (LS) | Label prefix to the title of the records from the foreign-table (LS). | Display |
foreign_table_loadIcons | boolean | If set, then the icons for the records of the foreign table are loaded and presented in the form. This depends on the 'selicon_field' of the foreign tables [ctrl] section being configured. | Display |
neg_foreign_table neg_foreign_table_where neg_foreign_table_prefix neg_foreign_table_loadIcons neg_foreign_table_imposeValueField | [mixed] | Four options corresponding to the 'foreign_table'-keys but records from this table will be referenced by negative uid-numbers (unless if MM is configured in which case it works like the group-type). 'neg_foreign_table' is active only if 'foreign_table' is defined also. | Display / Proc. |
fileFolder | string | Specifying a folder from where files are added to the item array. Specify the folder relative to the PATH_site, possibly using the prefix "EXT:" to point to an extension folder. Files from the folder is selected recursively to the level specified by "fileFolder_recursions" (see below) and only files of the extension defined by "fileFolder_extList" is selected (see below). Only the file reference relative to the "fileFolder" is stored. If the files are images (gif,png,jpg) they will be configured as icons (third parameter in items array). Example: 'config' => Array ( 'type' => 'select', 'items' => Array ( Array('',0), ), 'fileFolder' => 'EXT:cms/tslib/media/flags/', 'fileFolder_extList' => 'png,jpg,jpeg,gif', 'fileFolder_recursions' => 0, 'selicon_cols' => 8, 'size' => 1, 'minitems' => 0, 'maxitems' => 1, ) | Display / Proc |
fileFolder_extList | string | List of extensions to select. If blank, all files are selected. Specify list in lowercase. See "t3lib_div::getAllFilesAndFoldersInPath()" | Display / Proc |
fileFolder_recursions | integer | Depth of directory recursions. Default is 99. Specify in range from 0-99. 0 (zero) means no recursion into subdirectories. See "t3lib_div::getAllFilesAndFoldersInPath()" | Display / Proc |
allowNonIdValues | boolean | If "foreign_table" is enabled: If set, then values which are not integer ids will be allowed. May be needed if you use itemsProcFunc or just enter additional items in the items array to produce some string-value elements for the list. Notice: If you mix non-database relations with database relations like this, DO NOT use integers for values and DO NOT use "_" (underscore) in values either! Notice: Will not work if you also use "MM" relations! | Proc. |
default | string | Default value. If empty, the first element in the items array is selected. | Display / Proc. |
dontRemapTablesOnCopy | (See same feature for type="group", internal_type="db") Set it to the exact same value as "foreign_table" if you don't want values to be remapped on copy. | Proc. | |
rootLevel | boolean | If set, the "foreign_table_where" will be ign |