Examples

Minimal table configuration

A minimal example of the control section
[
    'ctrl' => [
        'title' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:minimalTableTitle',
        'label' => 'title',
        'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
    ],
    'columns' => [
        'title' => [
            'label' => 'LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:minimalTableTitleField',
            'config' => [
                'type' => 'input',
            ],
        ],
    ],
    'types' => [
        [
            'showitem' => 'title',
        ],
    ],
]

Property label is a mandatory setting, but the above properties are a recommended minimum. The list module shows an icon and a translated title of the table, and it uses the value of field title as title for single rows. Single record administration however is limited with this setup: This table does not implement soft delete, record rows can not be sorted between each other, record localization is not possible, and much more. In the database, only columns uid, pid and title are needed in ext_tables.sql with this setup.

Common table control configuration

A common example of the control section
'ctrl' => [
    'title' => 'Form engine - Common table control',
    'label' => 'title',
    'descriptionColumn' => 'description',
    'tstamp' => 'tstamp',
    'crdate' => 'crdate',
    'cruser_id' => 'cruser_id',
    'delete' => 'deleted',
    'sortby' => 'sorting',
    'default_sortby' => 'title',
    'versioningWS' => true,
    'rootLevel' => -1,
    'iconfile' => 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg',
    'origUid' => 't3_origuid',
    'languageField' => 'sys_language_uid',
    'transOrigPointerField' => 'l10n_parent',
    'transOrigDiffSourceField' => 'l10n_diffsource',
    'translationSource' => 'l10n_source',
    'searchFields' => 'title,description',
    'enablecolumns' => [
        'disabled' => 'hidden',
        'starttime' => 'starttime',
        'endtime' => 'endtime',
    ],
]

Core table tt_content

Table tt_content makes much more excessive use of the ['ctrl'] section:

'ctrl' => [
    'label' => 'header',
    'label_alt' => 'subheader,bodytext',
    'descriptionColumn' => 'rowDescription',
    'sortby' => 'sorting',
    'tstamp' => 'tstamp',
    'crdate' => 'crdate',
    'cruser_id' => 'cruser_id',
    'editlock' => 'editlock',
    'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:tt_content',
    'delete' => 'deleted',
    'versioningWS' => true,
    'groupName' => 'content',
    'origUid' => 't3_origuid',
    'type' => 'CType',
    'hideAtCopy' => true,
    'prependAtCopy' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.prependAtCopy',
    'copyAfterDuplFields' => 'colPos,sys_language_uid',
    'useColumnsForDefaultValues' => 'colPos,sys_language_uid,CType',
    'transOrigPointerField' => 'l18n_parent',
    'transOrigDiffSourceField' => 'l18n_diffsource',
    'languageField' => 'sys_language_uid',
    'translationSource' => 'l10n_source',
    'previewRenderer' => 'TYPO3\\CMS\\Backend\\Preview\\StandardContentPreviewRenderer',
    'enablecolumns' => [
        'disabled' => 'hidden',
        'starttime' => 'starttime',
        'endtime' => 'endtime',
        'fe_group' => 'fe_group',
    ],
    'typeicon_column' => 'CType',
    'typeicon_classes' => [
        'header' => 'mimetypes-x-content-header',
        'text' => 'mimetypes-x-content-text',
        'textpic' => 'mimetypes-x-content-text-picture',
        'image' => 'mimetypes-x-content-image',
        'textmedia' => 'mimetypes-x-content-text-media',
        'bullets' => 'mimetypes-x-content-list-bullets',
        'table' => 'mimetypes-x-content-table',
        'uploads' => 'mimetypes-x-content-list-files',
        'list' => 'mimetypes-x-content-plugin',
        'shortcut' => 'mimetypes-x-content-link',
        'script' => 'mimetypes-x-content-script',
        'div' => 'mimetypes-x-content-divider',
        'html' => 'mimetypes-x-content-html',
        'default' => 'mimetypes-x-content-text',
        'menu_abstract' => 'content-menu-abstract',
        'menu_categorized_content' => 'content-menu-categorized',
        'menu_categorized_pages' => 'content-menu-categorized',
        'menu_pages' => 'content-menu-pages',
        'menu_subpages' => 'content-menu-pages',
        'menu_recently_updated' => 'content-menu-recently-updated',
        'menu_related_pages' => 'content-menu-related',
        'menu_sitemap' => 'content-menu-sitemap',
        'menu_sitemap_pages' => 'content-menu-sitemap-pages',
        'menu_section' => 'content-menu-section',
        'menu_section_pages' => 'content-menu-section',
    ],
    'searchFields' => 'header,header_link,subheader,bodytext,pi_flexform',
]

A few remarks:

  • When tt_content records are displayed in the backend, the “label” property indicates that you will see the content from the field named “header” shown as the title of the record. If that field is empty, the content of field subheader and if empty, of field bodytext is used as title.
  • The field called “sorting” will be used to determine the order in which tt_content records are displayed within each branch of the page tree.
  • The title for the table as shown in the backend is defined as coming from a “locallang” file.
  • The “type” field will be the one named “CType”. The value of this field determines the set of fields shown in the edit forms in the backend, see the [‘types’] section for details.
  • Of particular note is the “enablecolumns” property. It is quite extensive for this table since it is a frontend-related table. Thus proper access rights, publications dates, etc. must be enforced.
  • Every type of content element has its own icon and its own class, used in conjunction with the Icon API to visually represent that type in the TYPO3 backend.