Bug #80541
closedBE FileBrowser didn't work in fluid content element
Added by Mélanie GALVEZ over 7 years ago. Updated about 6 years ago.
100%
Description
FileBrowser popup didn't works when clicking on button in fluid content element
The reason is that $className
is null
in the getElementBrowserInstance
method of the file typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php
To fix it, simply add :
if(empty($className)) { $className = 'TYPO3\CMS\Recordlist\Browser\FileBrowser'; }
before this line :
$className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers'][$this->mode];
Updated by Markus Klein over 7 years ago
- Status changed from New to Needs Feedback
Well this dialog is actually not meant for Frontend usage. Actually I'm not sure if you run in security issues if you do.
Updated by Oliver Pfaff over 7 years ago
- Has duplicate Bug #80727: $className must be a non empty string added
Updated by Oliver Pfaff over 7 years ago
Moin,
i have done some research because im encountered the same issue in the DCE extension.
Your solution will work, but seems not TYPO3 style :).
If you set the internal_type inside the TCA to file it will work also but don't seems the right way. it would be the right way if the internal type 'file_reference' was removed but i dont have find anything about it
The error is caused by this js call:
- onclick="setFormValueOpenBrowser('file_reference' ...
- file_reference seems to be the internal type inside the TCA config
in TYPO3 7.15 my onclick event is rendered with 'file' only and so we get the right class name. 'TYPO3\CMS\Recordlist\Browser\FileBrowser'.
Stored inside
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file'];
and called on line 147(7.6)-144(8.7) in ElementBrowserController.php
In 7.6 we don't have $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file_reference']; either.
So the error seems to be in the rendering process. I suppose that anywhere there, when the internal_type is file_reference, the mode will set on file before the output is generated and this is broken right now in 8.7.
But i can't identify the right spot in the core right now
@Mélanie GALVEZ can you tell us wich kind of fluid element you have used? I have tried some element but there i can't reproduce the error.
Updated by Claus Due over 7 years ago
This happens on any record type anywhere, if it contains a flexform with a section and section object and one or more fields of type "group" internal type "file_reference". I would also assume this happens anywhere if you use a "group" field with internal type "file_reference". As such, it's neither related to frontend or specifically to fluidcontent (it's just easier to reproduce with an EXT:fluidcontent or EXT:fluidpages template's Flux form, if you've already got one).
Boils down to: "file" vs. "file_reference" type in "group" TCA fields; browse feature broken with "file_reference".
it would be the right way if the internal type 'file_reference' was removed but i dont have find anything about it
I don't see why that would be removed. File and FileReference both serve their proper purpose for this component. And until it gets deprecated it's definitely still proper API and should be supported ;)
Updated by Tabea David over 7 years ago
Any news on this? I've got the same issue.
The fix mentioned above works, but the line has to be placed after and not before the line `$className = ...`
:
──────────────────────────────────────────────────────────────────────────────────────────────────────────
modified: typo3_src-8.7.1/typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php
──────────────────────────────────────────────────────────────────────────────────────────────────────────
@ ElementBrowserController.php:144 @ class ElementBrowserController
protected function getElementBrowserInstance()
{
$className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers'][$this->mode];
+ if (empty($className)) $className = 'TYPO3\CMS\Recordlist\Browser\FileBrowser';
$browser = GeneralUtility::makeInstance($className);
if (!$browser instanceof ElementBrowserInterface) {
Updated by Markus Klein over 7 years ago
- Description updated (diff)
- Status changed from Needs Feedback to New
- Target version set to Candidate for patchlevel
Updated by Markus Klein over 7 years ago
Is version 7 also affected?
In general seeing this error means that the mode
is not set via GET
parameter.
The bug is therefore in the calling code and not in the ElementBrowserController
.
The provided "fix" is rather a dirty workaround.
Updated by Tobias Gülzow over 7 years ago
Hi everyone.
Our sightly less hacky workaround here is:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ElementBrowsers']['file_reference'] = 'TYPO3\CMS\Recordlist\Browser\FileBrowser';
Using this in an ext_localconf makes the filebrowser work again.
Sadly, the Backend complains about missing files, but this looks like a false alert.
Saving the element works as it should.
The display on the frontend is as it should be.
Tobi
Updated by Markus Klein over 7 years ago
- Assignee set to Markus Klein
- Priority changed from Should have to Must have
Updated by Markus Klein over 7 years ago
- Status changed from New to Accepted
- Complexity set to medium
- Is Regression changed from No to Yes
- Sprint Focus set to On Location Sprint
Updated by Anja Leichsenring about 7 years ago
- Sprint Focus deleted (
On Location Sprint)
Updated by Kurt Gusbeth about 6 years ago
Why is this bug still not fixed in TYPO3 8.7.17?
Adding this line
if (empty($className)) $className = 'TYPO3\CMS\Recordlist\Browser\FileBrowser';
helped for me.
Updated by Gerrit Code Review about 6 years ago
- Status changed from Accepted 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/58431
Updated by Gerrit Code Review about 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58435
Updated by Christian Kuhn about 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 21499a5acd3c2cdaa9055585a4291ca03332bff2.
Updated by Gerrit Code Review about 6 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58435
Updated by Gerrit Code Review about 6 years ago
Patch set 3 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58435
Updated by Christian Kuhn about 6 years ago
- Status changed from Under Review to Resolved
Applied in changeset 5ccb11cd76247ce709fd10f94c435e8500f99d0e.