Folder
New in version 13.0
When using the folder 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 folder creates a field where folders can be attached to
the record. The values are stored as a combined identifier in a
comma-separated list (csv).
The according database field is generated automatically.
Table of contents:
Example
A workshop refers to the folder with its materials:
The folder with the materials of a workshop
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'materials' => [
'label' => 'my_extension.db:talk.materials',
'config' => [
'type' => 'folder',
'relationship' => 'manyToOne',
'elementBrowserEntryPoints' => [
'_default' => '1:/workshops/',
],
'behaviour' => [
'allowLanguageSynchronization' => true,
],
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'materials',
'workshop',
'before:--div--;core.form.tabs:access',
);
Properties of the TCA column type folder
| Name | Type | Scope |
|---|---|---|
| boolean | Proc. | |
| integer | Display | |
| array | Display | |
| array | Display | |
| array | ||
| array | ||
| array | ||
| boolean | Display | |
| boolean | Display | |
| integer > 0 | Display / Proc. | |
| integer > 0 | Display | |
| boolean | Display / Proc. | |
| boolean | Display | |
| string | Proc. | |
| integer | 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/280-tx_myextension_talk-materials.php<?php use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; defined('TYPO3') or die(); ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [ 'materials' => [ 'label' => 'my_extension.db:talk.materials', 'config' => [ 'type' => 'folder', 'relationship' => 'manyToOne', 'elementBrowserEntryPoints' => [ '_default' => '1:/workshops/', ], 'behaviour' => [ 'allowLanguageSynchronization' => true, ], ], ], ]); ExtensionManagementUtility::addToAllTCAtypes( 'tx_myextension_talk', 'materials', 'workshop', 'before:--div--;core.form.tabs:access', );
-
- Type
- integer
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['autoSizeMax']
- Scope
- Display
The maximum size (height) of the select field.
The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified size and never larger than the value of
auto.Size Max Note
Only has an effect if maxitems is greater than 1.
-
- Type
- array
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['elementBrowserEntryPoints']
- Scope
- Display
By default, the last folder is used when opening the element browser. Setting this configuration value changes this behaviour.
This configuration value contains an array. For the column type folder only the value with the key
_defaultis used.When opening the element browser the folder with the
_defaultkey is preselected.
The element browser of the workshop materials opens the folder
workshops/ of the first storage:
<?php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
defined('TYPO3') or die();
ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [
'materials' => [
'label' => 'my_extension.db:talk.materials',
'config' => [
'type' => 'folder',
'relationship' => 'manyToOne',
'elementBrowserEntryPoints' => [
'_default' => '1:/workshops/',
],
'behaviour' => [
'allowLanguageSynchronization' => true,
],
],
],
]);
ExtensionManagementUtility::addToAllTCAtypes(
'tx_myextension_talk',
'materials',
'workshop',
'before:--div--;core.form.tabs:access',
);
It is also possible to use a special TSconfig key:
'elementBrowserEntryPoints' => [
'_default' => '###PAGE_TSCONFIG_ID###',
],
This key has then to be defined on field level:
TCEFORM.tx_myextension_talk.materials.PAGE_TSCONFIG_ID = 1:/workshops/
In case an allowed table has no entry point defined, the _default is used.
In case _default is also not set or element is not
used at all, the previous behaviour applies.
-
The field of type folder can enable all common field control options. Furthermore the following are available:
-
- Type
- array
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['fieldControl']['elementBrowser']
- Scope
- Display
The element browser field control used in
type='folder'renders a button to open an element browser to choose a folder.It is enabled by default if rendering a folder element.
-
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
- boolean
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['hideDeleteIcon']
- Scope
- Display
Removes the delete icon next to the selector box.
-
- Type
- boolean
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['hideMoveIcons']
- Scope
- Display
Removes the move icons next to the selector box.
-
- Type
- integer > 0
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['maxitems']
- Scope
- Display / Proc.
Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.
-
- Type
- integer > 0
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['minitems']
- Scope
- Display
Minimum number of child items. Defaults to 0. JavaScript record validation prevents the record from being saved if the limit is not satisfied.
-
- Type
- boolean
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['multiple']
- Scope
- Display / Proc.
Allows the same item more than once in a list.
-
- 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
- string
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['relationship']
- Scope
- Proc.
- Added
- 13.3
Defines whether the field holds one folder or several. This decides which value a Record object provides for this field, for example in a Fluid template.
one,To One manyTo One - The field provides a single
Folderobject, ornullif no folder is selected. maxitems is set to1automatically, overriding any other value.
With any other value, or if
relationshipis not set, the field provides aLazy. It contains each selected folder followed by all of its subfolders, recursively.Folder Collection EXT:my_extension/Configuration/TCA/Overrides/280-tx_myextension_talk-materials.php<?php use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; defined('TYPO3') or die(); ExtensionManagementUtility::addTCAcolumns('tx_myextension_talk', [ 'materials' => [ 'label' => 'my_extension.db:talk.materials', 'config' => [ 'type' => 'folder', 'relationship' => 'manyToOne', 'elementBrowserEntryPoints' => [ '_default' => '1:/workshops/', ], 'behaviour' => [ 'allowLanguageSynchronization' => true, ], ], ], ]); ExtensionManagementUtility::addToAllTCAtypes( 'tx_myextension_talk', 'materials', 'workshop', 'before:--div--;core.form.tabs:access', );
-
- Type
- integer
- TCA path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']['size']
- Scope
- Display
The minimum size (height) of the select field.
The size of the select field will be automatically adjusted based on the number of selected items. The select field will never be smaller than the specified
sizeand never larger than the value of autoSizeMax.