I can't figure out which setting I have to activate to allow non-admin users to delete file references in the backend.
As admin I have that little trash icon which is missing when logged in as non-admin user.
I set every single flag to allow data manipulation in the backend users module but nothing worked so far. The only option is to give the user admin privileges. What do I miss?
Edit:
I am on TYPO3 10.4
Edit:
TCA for field:
'image' => [
'exclude' => true,
'label' => 'Image',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'foreign_types' => [
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'foreign_match_fields' => [
'fieldname' => 'image',
'tablenames' => 'tx_association_domain_model_association',
'table_local' => 'sys_file',
],
'maxitems' => 1,
'minitems' => 0
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
Related
I am trying to find solution, that will allow user to upload PDF file via TCA. Uploaded file musn't create relation with sys_file_reference.
My current code in TCA:
'pdf_data' => [
'exclude' => true,
'label' => 'PDF file',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'pdf_file',
[
'appearance' => [
'createNewRelationLinkTitle' => 'Add PDF file',
],
'maxitems' => 1,
'minitems' => 0,
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
],
],
'filter' => [
'0' => [
'parameters' => [
'allowedFileExtensions' => 'pdf'
]
]
],
'default' => null,
],
'pdf'
),
]
],
Although Thomas already stated, that it is very uncommon and you really need a good reason to store PDF files in a database, you could still try to provide your own form engine rendering via TCA column type user
https://docs.typo3.org/m/typo3/reference-tca/10.4/en-us/ColumnsConfig/Type/User.html
Just make sure to provide a render type, that will return basic information about the stored data, so that BE users will get a convenient user interface to deal with the files.
Additionally you might want to deal with the data while it gets stored, so providing methods for the DataHandler would be necessary too.
https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Typo3CoreEngine/Introduction/Index.html
I use the following code to make an image selection available in the backend:
(TYPO3 docs - inline - File Abstraction Layer)
'image' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.images',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
],
// custom configuration for displaying fields in the overlay/reference table
// to use the image overlay palette instead of the basic overlay palette
'overrideChildTca' => [
'types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
],
],
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
I want to limit the selection to 1 item which should be:
TYPO3 dosc - maxitems option
image => [
'config' => [
'maxitems' => 1,
],
],
I cannot find how to add that ... all I tried gives errors
Sometimes, you just have to find the matching part of documentation...
File abstraction layer (FAL)
The API call is \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(). The first argument is the name of the current field, the second argument is an override configuration array, (...)
So it should do with overriding a part of the generated configuration by:
'image' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.images',
'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'image',
[
'maxitems' => 1
]
)
]
I've an issue wit TYPO3 selectField, selectMultipleSideBySide.
I've configure the field like this:
$tmpColumns = [
'tx_tcademo_list' => [
'label' => 'Items',
'config' => [
'type' => 'select',
'renderType' => 'selectMultipleSideBySide',
'foreign_table' => 'tx_tcademo_domain_model_item',
'MM' => 'tx_tcademo_record_item_mm',
'MM_hasUidField' => true,
'MM_match_fields' => [
'tablenames' => 'fe_users',
'fieldnames' => 'tx_tcademo_items',
],
'minitems' => 0,
'maxitems' => 99999,
],
],
];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('fe_users', $tmpColumns);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'tx_tcademo_list');
Issue is:
The field is added to fe_users correctly, and items can be selected as expected, and they're saved to db MM relation, but when form is redrawn, the selected items are not marked as selected, and will be overwritten with next save.
Link to extension which demonstrates the issue:
TCA Demo extension
On typo3v9 i had working file upload field with this TCA configuration:
'image' => [
'exclude' => 0,
'label' => 'image upload',
'config' => [
'type' => 'group',
'internal_type' => 'db',
'uploadfolder' => 'uploads/folder',
'show_thumbs' => 1,
'size' => 5,
'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'disallowed' => '',
],
],
i get this result:
but after migration to typo3v10 it does not work properly and give this result:
Someone have working solution for single file upload field?
I guess you mean internal_type=file ? That's deprecated. Here an example for image upload. However you can allow other types here too, I am sure you can find more info on that.
'photos' => [
'exclude' => true,
'label' => 'LLL:EXT:xxx/Resources/Private/Language/locallang_db.xlf:tx_xxx_domain_model_activity.photos',
'config' =>
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
'photos',
[
'appearance' => [
'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference'
],
'foreign_types' => [
'0' => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
],
\TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [
'showitem' => '
--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
--palette--;;filePalette'
]
],
'maxitems' => 30
],
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
),
],
In a custom built TYPO3 extension, records are only available in language -1 in the backend. That was specified as such, but should now be changed so records can be translated.
Something is missing. I thought this would be in TCA, but the definitions look quite normal:
'columns' => [
'sys_language_uid' => [
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'special' => 'languages',
'items' => [
[
'LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages',
-1,
'flags-multiple'
]
],
'default' => 0,
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => true,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['', 0],
],
'foreign_table' => 'tx_myext_domain_model_item',
'foreign_table_where' => 'AND tx_myext_domain_model_item.pid=###CURRENT_PID### AND tx_myext_domain_model_item.sys_language_uid IN (-1,0)',
],
],
Also, when I change TCA, for example change config as such:
'config' => array(
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => array(
array('LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1),
array('LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0)
),
),
It's still the same: only language -1 (ALL) is selectable.
Of course, the sysfolder those records are on is translated in multiple languages. Also, the columns for sys_language_uid, l10n_parent and l10n_diffsource are present in the database.
Are the other languages maybe disabled somewhere? Where else could I look?
Or which element could be missing else to make records translateable?
Thanks for any hint.