-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flux:field.file for TYPO3 11 and 12 #2139
Comments
I also recognized that the deprecation hints were removed. The file field is still working. BUT: So i thought in another way and found a workaround writing a little XClass which restores the original behaviour of the element browser. class ElementBrowser extends \TYPO3\CMS\Backend\Form\FieldControl\ElementBrowser
{
/**
* Modify result of the original render function if TCA config myFilebrowserFix is set.
*
* @return array
*/
public function render(): array
{
$fieldConfig = $this->data['parameterArray']['fieldConf']['config'];
if($fieldConfig['myFilebrowserFix']) {
$configArray = parent::render();
if(is_array($configArray)) {
if(array_key_exists('linkAttributes', $configArray)) {
// This makes the folder button a file selector instead a db selector.
$configArray['linkAttributes']['data-mode'] = 'file';
}
}
return $configArray;
} else {
return parent::render();
}
}
} In this way I can restore the original behaviour of the file browser for a flux field by adding config="{myFilebrowserFix: 'true'}" to the flux:field.file in the template. Regards, |
It is supported, but there are limitations imposed by the TYPO3 core. Most notably that you cannot use it within sections / section objects. Historically this field has been a The reason all the individual field types were initially deprecated in Flux was that heavy changes were being made to TCA constantly through all supported versions since 8.7, and keeping up with all of those changes to internally rewrite types on each version was becoming unfeasible. The substitute idea was to provide a more generic field ViewHelper where each editor was responsible for choosing the @mdittberner Thanks for posting your workaround. I know that this response won't be the one you (and many others) are looking for, but I should explain something about Flux that might help to explain why Flux won't be doing things like adding an XCLASS that overrides a core class to re-animate some feature that was (partially, incompletely) killed off by the TYPO3 core: Flux fields are merely an abstraction over TCA. The purpose is to allow you to do literally anything that's possible to do with TCA, but with a proper object-and-ViewHelper API instead of a huge anonymous array. Flux is not, and never was, designed to change how TCA works and what is possible to do with TCA. This means that if the TYPO3 core decides that something is no longer possible (group with "file" type, wizards as sub-arrays, etc.) then Flux will simply follow suit and like with wizards straight up remove all of those ViewHelpers, or in some cases like with "file" choose the closest reasonably matching type of field and create a The mantra basically is: if you can do it with TCA, you can do it with Flux - and if you can do it with Flux, you can do it with TCA (but you'd need to write a hell of a lot more TCA than Flux code!). If you can't do it with TCA you also can't do it with Flux. My advise will always be to migrate your implementations as soon as you discover that a certain thing - such as group with "file" type - will become impossible in the future. What this particular XCLASS will do, will just be to prolong the pain. The field type/combo is marked for death and it will die - it's only a coincidence that for some reason, the JS component is still capable of reading and using the Lastly I should say that I do often strongly disagree with decisions made in the TYPO3 core especially concerning the removal of features or locking-in of API, but it's a reality that I've tried and failed to change many, many times with each attempt costing a lot of time and causing a lot of grief. Unfortunately, once it's decided to chop off parts of the API then nothing I can say or do will change it. Sometimes, an XCLASS re-animates what should be dead but inevitably it gets killed for good anyway. So it's best not to try, accept defeat and bite the migration bullet. I hate to say that, but it really is. |
@NamelessCoder Have many thanks to Your detailed answer and your clear words. I supposed that there are good reasons for never touching core behaviour with an XClass. Your statements brought more light in the darkness. My favourite was " I can pretty much guarantee you that this will also be removed as soon as someone finds out it is still there.". Hart gefeiert! ^^ |
You're most welcome, @mdittberner - and sorry I couldn't give you better news. It's not a fun situation this one, all the way around! |
I have a solution:
and in configuration:
Unfortunately, the restriction for the file extensions does not work as intended |
@grischpel Another problem with that solution is that if I am remembering things correctly, the data type stored by the field type you use is different from the data type stored by the old ViewHelper, to the point where they are incompatible. The field also (again, IIRC) does not support multiple values. The value it stores also isn't nice to work with when attempting to do anything except for linking to the file (does not store the file path or UID in raw format, cannot support As such it is most definitely not a drop-in replacement, but perhaps it can serve in some cases as an alternative, in particular for use cases with section containers. By the way:
|
Is flux:field.file now supported in TYPO3 11 or 12?
When I read the history of the viewhelper the comment was removed with deprecate.
The text was updated successfully, but these errors were encountered: