3

I have added a checkbox to sys_file_reference and utilize it to override some responsive fluid rendering. Works fine. Now I would like to disable this checkbox in the pages media field. Normally disabling fields is easily done via page typoscript

TCEFORM.TABLENAME.FIELDNAME.disabled = 1

However since the sys_file_reference is used in both pages and tt_content this won't work since it globally disables it:

TCEFORM.sys_file_reference.myfield.disabled = 1

I know I can disable fields for certain CTypes by using this syntax:

TCEFORM.tt_content.myfield.types.textmedia.disabled = 1

Is there something similar for tables instead of types? I unsuccessfully tried

TCEFORM.sys_file_reference.myfield.tables.pages.disabled = 1

TCEFORM.pages.myfield.disabled = 1

TCEFORM.pages.tables.sys_file_reference.myfield.disabled = 1

TCEFORM.pages.myfield.tables.sys_file_reference.disabled = 1

TCEFORM.pages.myfield.types.sys_file_reference.disabled = 1

Or do I need to do this in the PHP TCA Override?

thanks

2
  • instead of TCEFORM.tt_content... you can use TCEFORM.pages....
    – Naderio
    Aug 12, 2019 at 16:56
  • I did try that, but since that is not the table I'm working on it doesnt help. I added some more examples that I tried.
    – Ja Nosch
    Aug 13, 2019 at 5:01

1 Answer 1

3
+50

In TCA config you can override the childs config for an specific field. So you can set the child TCA (sys_file_reference) of media for a field as type passthrough to make it hidden:

$GLOBALS['TCA']['pages']['columns']['media']['config']['overrideChildTca']['columns']['myfield'] = [
    'config' => [
        'type' => 'passthrough'
    ]
];

See the TCA Reference for more information.

2
  • 1
    Thanks, this comment got me in the right direction. two things though: 1) the correct setting is $GLOBALS['TCA']['pages']['columns']['media']['config']['overrideChildTca']['columns']['myfield'] = please edit this so i can make your answer the accepted answer 2) if you use a custom renderType you need to make that passthrough instead of type, otherwise the field will still get rendered
    – Ja Nosch
    Feb 27, 2020 at 9:51
  • thanks for you hint @JaNosch, I have edited the array declaration Feb 27, 2020 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.