enablecolumns¶
-
enablecolumns
¶ -
- Type
- array
- Path
- $GLOBALS['TCA'][$table]['ctrl']
- Scope
- Proc. / Display
Changed in version 13.3
The column definitions for these settings are auto-created.
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. This property is used by the RestrictionBuilder to create SQL fragments.
These 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
- Defines which field serves as hidden/disabled flag.
starttime
- Defines which field contains the starting time.
endtime
- Defines which field contains the ending time.
fe_group
- Defines which field is used for access control via a selection of FE user groups.
Note
In general these fields do 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:
Warning
Columns created automatically by being defined by this property still need to be added manually to the palettes and types definition.
Due to the TCA loading order these columns are only created if the according ctrl property was added in the original definition in
Configuration/TCA/<tablename>.php
, not if they were defined in the overrides likeConfiguration/TCA/Overrides/something.php
.See also the delete and editlock features which are related, but are active for both frontend and backend.
Examples of column enable configurations¶
<?php
return [
'ctrl' => [
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
// ...
],
'palettes' => [
'paletteHidden' => [
'showitem' => '
hidden
',
],
'paletteAccess' => [
'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access',
'showitem' => '
starttime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:starttime_formlabel,
endtime;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:endtime_formlabel,
--linebreak--,
fe_group;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:fe_group_formlabel,
',
],
],
'types' => [
0 => [
'showitem' => '
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
[...],
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;paletteHidden,
--palette--;;paletteAccess,
',
],
],
];
Define all enablecolumn fields¶
Make table hideable¶
<?php
return [
'ctrl' => [
'enablecolumns' => [
'disabled' => 'hidden',
],
// ...
],
'palettes' => [
'visibility' => [
'showitem' => 'hidden',
],
],
'types' => [
0 => [
'showitem' => '
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:general,
[...],
--div--;LLL:EXT:core/Resources/Private/Language/Form/locallang_tabs.xlf:access,
--palette--;;visibility,
',
],
],
];
Common enable fields¶
[
'ctrl' => [
'title' => 'Form engine - Common table control',
'label' => 'title',
'descriptionColumn' => 'description',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'delete' => 'deleted',
'sortby' => 'sorting',
'default_sortby' => 'title',
'versioningWS' => true,
'rootLevel' => -1,
'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'translationSource' => 'l10n_source',
'searchFields' => 'title,description',
'enablecolumns' => [
'disabled' => 'hidden',
'starttime' => 'starttime',
'endtime' => 'endtime',
],
'security' => [
'ignorePageTypeRestriction' => true,
],
],
]
Enablecolumns / enablefields usage¶
Most ways of retrieving records in the frontend automatically respect the
ctrl->enablecolumns
settings:
Enablecolumns in TypoScript¶
Records retrieved in TypoScript via the objects RECORDS, CONTENT automatically respect the settings in section ctrl->enablecolumns.
Enablecolumns / enablefields in Extbase¶
In Extbase repositories the records are hidden in the frontend by default,
however this behaviour can be disabled by setting
$querySettings->setIgnoreEnableFields(true)
in the
repository.
Enablecolumns in queries¶
Using the QueryBuilder enable columns restrictions are automatically applied.
The same is true when select() is called on the connection.
See the Restriction builder for details.