Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable sys_file_reference_field only for pages table

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

like image 378
Ja Nosch Avatar asked Mar 20 '26 02:03

Ja Nosch


1 Answers

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.

like image 72
René Pflamm Avatar answered Mar 23 '26 08:03

René Pflamm



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!