Project

General

Profile

Actions

Bug #88977

open

ElementBrowser in case of files does not return "table_uid" to the TCA field type => "group" when using multiple tables + sys_file relation which throws an error

Added by Rostyslav Matviyiv over 5 years ago. Updated over 5 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend JavaScript
Target version:
-
Start date:
2019-08-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
element browser, TCA group field, sys_file
Complexity:
medium
Is Regression:
Sprint Focus:

Description

Hey! So we had previously next configuration of a field(type=>group)

'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages',
'minitems' => 0,
'maxitems' => 1000,
'size' => 5,
'wizards' => [
'suggest' => ['type' => 'suggest'],
],
],

So as only pages was allowed, then in DB we was saving just IDs separated by comma

Now we need to add several other models and support sys_file:

'config' => [
'type' => 'group',
'internal_type' => 'db',
'allowed' => 'pages,sys_file,tx_blabla_domain_model_meeting,tx_blabla_domain_model_recording',
'minitems' => 0,
'maxitems' => 1000,
'size' => 8,
'wizards' => [
'suggest' => ['type' => 'suggest'],
],
'fieldControl' => [
'insertClipboard' => ['disabled' => false],
],
'appearance' => [
'elementBrowserType' => 'file',
'elementBrowserAllowed' => 'pdf,youtube,zip,doc,docx,mp4,jpg,jpeg,png,svg',
],
],

we should have pages on the first place because otherwise we will have issues with data which is already in DB, as there was no tables references in identifiers but only IDs (separated by comma), TYPO3 will render that IDs with first table in 'allowed' field, when you open content element on TYPO3 backend. So if you had "1003,1006" in the field table, it will be now converted to "pages_1003,pages_1006".

But in that case.... we have another issue (which is, I think a TYPO3 bug..) I will explain it here:
Lets say you have next 'allowed':

'allowed' => 'pages,sys_file,tx_blabla_domain_model_meeting,tx_blabla_domain_model_recording',

so sys_file is on the second place.

Now lets open our Content Element and lets add a file, for it we need to click on ElementBrowser button:

Then ElementBrowser will be opened in separate tab/window but it will be still connected to the previous page. Then you should select a file and click on it.

your file will be added to the field type=>group but just its UID but not TABLE_UID, so when you save content element it will see that there is only UID available and will take first table from allowed field, so file with UID=999 will be now added as a -> pages_999 which is completely wrong.

My question is what I am doing wrong? or maybe you know some workaround (moving sys_file on the first place isn't a solution for me in this case), or you have a plan how to fix it?

As I see misunderstanding is somewhere here:

This is a place where we returning our Identifier (uid or table_uid) from Element Browser to the TCA field

So in altElValue is transferred just UID value, however in elValue we have table_uid

(My idea was that someone just by mistake misunderstood it and it should be just converted to -> "elValue ? elValue : altElValue"), or altElValue and elValue should have switched values in the place where they are set.

BTW... clicking on this button will open just a Browser for pages or models but not FilesBrowser... ? another bug?


Files

1.png (1.06 KB) 1.png Rostyslav Matviyiv, 2019-08-19 18:05
2.png (6.72 KB) 2.png Rostyslav Matviyiv, 2019-08-19 18:07
3.png (166 KB) 3.png Rostyslav Matviyiv, 2019-08-19 18:13
Actions

Also available in: Atom PDF