Project

General

Profile

Actions

Task #94406

closed

TCA select fileFolder should be able to call custom class or hook to scope output

Added by Joerg Boesche over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
Start date:
2021-06-24
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Sprint Focus:

Description

The TCA type select and renderType selectSingle has no option to change the "fileFolder" path with a custom class (userFunc) or hook.
If your T3 instance has more than one project / site project, the icons should be scoped to the project A or B. Project A should not see files of project B.

The available itemsProcFunc is called after the internal `addItemsFromFolder` method. All the magic is done before the itemsProcFunc and there is no way to change the fileFolder configuration before.

Idea:
The fileFolder configuration should accept multiple ways of definiton.
  • EXT:my_ext/Resources/Public/Icons/
  • RELATIVE_TO_PUBLIC_PATH/fileadmin/foo/bar
  • VENDOR\ACME\Hooks\TCA\MyCustomFileFolderHook::class->rewriteFolderPath(....)

TCA documentation: https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/selectSingle.html#filefolder

 'field' => [
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'maxitems' => 1,
                'items' => [
                    ['', 0],
                ],
                'fileFolder' => 'EXT:my_ext/Resources/Public/Icons/',
                'fileFolder_extList' => 'svg',
                'fileFolder_recursions' => 0,
            ],
        ],

Example and idea with a custom class

 'field' => [
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'maxitems' => 1,
                'items' => [
                    ['', 0],
                ],
                'fileFolder' => 'VENDOR\ACME\Hooks\TCA\MyCustomFileFolderHook::rewriteFolderPath',
                'fileFolder_extList' => 'svg',
                'fileFolder_recursions' => 0,
            ],
        ],

Actions

Also available in: Atom PDF