Task #94406

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

Added by Joerg Boesche 4 months ago. Updated about 1 month 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,
            ],
        ],

#1

Updated by Gerrit Code Review 3 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69832

#2

Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69832

#3

Updated by Gerrit Code Review 3 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69832

#4

Updated by Gerrit Code Review 3 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69832

#5

Updated by Gerrit Code Review 3 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69832

#6

Updated by Gerrit Code Review 3 months ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69832

#7

Updated by Oliver Bartsch 3 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#8

Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF