TYPO3 DCE remove “Select & Upload Files” button - Stack Overflow

I’m using TYPO3 v12 and DCE (Dynamic Content Elements) extension.I have managed to remove the “Select

I’m using TYPO3 v12 and DCE (Dynamic Content Elements) extension.

I have managed to remove the “Select & Upload Files” button from the standard content elements (Image, Image & Text, Media) with the following lines in TSConfig:

TCEFORM.tt_content.image.config.appearance.fileUploadAllowed = 0 TCEFORM.tt_content.assets.config.appearance.fileUploadAllowed = 0

Unfortunately, I cannot find a way to remove the upload button within new elements created with DCE (Dynamic Content Elements) extension. I tried to follow the pattern of:

TCEFORM.[TABLE].[COLUMN].config.appearance.fileUploadAllowed = 0

… but with DCE it’s not as straight forward, it seems to be more “nested”.

I’ve tried different combinations but without success.
Maybe there’s another way? Directly within DCE or perhaps completely elsewhere?

I looked all over, but cannot find any answers. I only found a way to disable the “Select & Upload Files” button for each Backend-User, but I would prefer to remove it globally and not have to think about it each time for each (new) user (group).

I’m using TYPO3 v12 and DCE (Dynamic Content Elements) extension.

I have managed to remove the “Select & Upload Files” button from the standard content elements (Image, Image & Text, Media) with the following lines in TSConfig:

TCEFORM.tt_content.image.config.appearance.fileUploadAllowed = 0 TCEFORM.tt_content.assets.config.appearance.fileUploadAllowed = 0

Unfortunately, I cannot find a way to remove the upload button within new elements created with DCE (Dynamic Content Elements) extension. I tried to follow the pattern of:

TCEFORM.[TABLE].[COLUMN].config.appearance.fileUploadAllowed = 0

… but with DCE it’s not as straight forward, it seems to be more “nested”.

I’ve tried different combinations but without success.
Maybe there’s another way? Directly within DCE or perhaps completely elsewhere?

I looked all over, but cannot find any answers. I only found a way to disable the “Select & Upload Files” button for each Backend-User, but I would prefer to remove it globally and not have to think about it each time for each (new) user (group).

Share Improve this question asked Nov 18, 2024 at 21:19 kameleonkakameleonka 315 bronze badges 1
  • DCE is using Flexforms to create the fields in your Content Element. I think you need to take a look at your created DCE. And add an appearance entry to the flexform config of the field. But not sure. – Mogens Commented Nov 18, 2024 at 21:25
Add a comment  | 

1 Answer 1

Reset to default 0

To remove the "Select & Upload Files" button in TYPO3, TSConfig doesn't allow direct customization of configuration arrays.

Instead, you can listen to the AfterFlexFormDataStructureParsedEvent event.

Create a FlexFormParsingModifyEventListener Class :

<?php
declare(strict_types=1);

namespace MyVendor\MySitepackage\EventListener;

use TYPO3\CMS\Core\Configuration\Event\AfterFlexFormDataStructureParsedEvent;

final class FlexFormParsingModifyEventListener
{
    public function __invoke(AfterFlexFormDataStructureParsedEvent $event): void
    {
        $identifier = $event->getIdentifier();

        if (
            (($identifier['fieldName'] ?? '') === 'pi_flexform') &&
            (($identifier['tableName'] ?? '') === 'tt_content') &&
            (($identifier['dataStructureKey'] ?? '') === '*,dce_gallery')
        ) {
            $parsedDataStructure = $event->getDataStructure();
            if (isset($parsedDataStructure['sheets']['sheet.tabGeneral']['ROOT']['el']['settings.image']['config'])) {
                $parsedDataStructure['sheets']['sheet.tabGeneral']['ROOT']['el']['settings.image']['config']['appearance']['fileUploadAllowed'] = 0;
            }
            $event->setDataStructure($parsedDataStructure);
        }
    }
}

Register Event Listener in Services.yaml

MyVendor\MySitepackage\EventListener\FlexFormParsingModifyEventListener:
    tags:
        -   name: event.listener
            identifier: 'my_sitepackage/modify-data-structure'
            event: TYPO3\CMS\Core\Configuration\Event\AfterFlexFormDataStructureParsedEvent

Clear BO caches.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745593917a4634992.html

相关推荐

  • TYPO3 DCE remove “Select &amp; Upload Files” button - Stack Overflow

    I’m using TYPO3 v12 and DCE (Dynamic Content Elements) extension.I have managed to remove the “Select

    15小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信