admin管理员组文章数量:1022949
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
1 Answer
Reset to default 0To 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.
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
1 Answer
Reset to default 0To 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.
本文标签: TYPO3 DCE remove “Select amp Upload Files” buttonStack Overflow
版权声明:本文标题:TYPO3 DCE remove “Select & Upload Files” button - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745593914a2158047.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论