I am making a custom template for the 'File Links' element.
In it I want to disable download of some of the files until the frontend user has logged in.
So my problem is the Access tab with the Frontend Usergroup field is not availble on the file objects.
How do I add the access tab?
I have tried making sys_file_metadata.php
with:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('sys_file_metadata', 'access','', 'after:title');
Essentially, I want to show a list of all links, but depending on the usergroup some will link to the login page instead of the download.
Edit: I can add the user groups field manually like this:
$newFields = [
'fe_groups' => [
'label' => 'Usergroup Access',
'exclude' => true,
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'size' => 5,
'maxitems' => 20,
'foreign_table' => 'fe_groups',
]
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('sys_file_metadata', $newFields);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'sys_file_metadata',
'fe_groups',
'',
'after:title'
);
However, the only problem is that it does not show up when you debug the template?
Turned out to be very simple. To find available properties I was using: <f:debug>{_all}</f:debug>
However this was giving me a shortened list of properties. So when I used <f:debug>{file.properties}</f:debug>
it expanded that list to include the value I was looking for: fe_groups