Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable fields in tca only for certain ctypes

Tags:

typo3

I want to disable certain fields in the backend, e.g. many fields of gridelements and other content elements. I know about the possibilities of TCEFORM but it allowes only to disable a field in all cTypes. I need a way to disable certain field only for certain cTypes.

Is there a way to achieve this? Thanks

like image 318
lisardo Avatar asked Oct 29 '25 16:10

lisardo


2 Answers

You have full control over which field are shown, if you adapt TCA for tt_content. You can override TCA with your customer extensions (sitepackage).

The following file contains fields, which are shown for CType header (TYPO3 CMS 7.6)

EXT:sitepackage/Configuration/TCA/Overrides/tt_content.php

<?php
defined('TYPO3_MODE') or die();

call_user_func(function () {
    $GLOBALS['TCA']['tt_content']['types']['header']['showitem'] = '--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.general;general,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.headers;headers,rowDescription,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.appearance,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.frames;frames,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.visibility;visibility,--palette--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:palette.access;access,--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.extended,--div--;LLL:EXT:lang/locallang_tca.xlf:sys_category.tabs.category,categories';
});

Remove or add any fields after your needs and do so for any CType you wish to change. See also https://docs.typo3.org/typo3cms/TCAReference/7.6/Reference/Types/Index.html

like image 122
jokumer Avatar answered Oct 31 '25 10:10

jokumer


Meanwhile (since 9 LTS) it is possible via TsConfig:

TCEFORM.tt_content.subheader.types.text.disabled = 1

… disables the subheader field for all text content elements.

You can even disable a field for all cTypes and define an exception:

TCEFORM.tt_content.subheader{
    disabled = 1
    types.text.disabled = 0
}
like image 41
Ben Avatar answered Oct 31 '25 10:10

Ben



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!