FluidTYPO3 / flux

TYPO3 extension Flux: Dynamic Fluid FlexForms
https://fluidtypo3.org
145 stars 214 forks source link

[FEATURE] Add extension config to produce unique file field names #2171

Closed NamelessCoder closed 4 months ago

NamelessCoder commented 4 months ago

TYPO3 has a limitation (one among many) when dealing with with FAL references within FlexForms. The field name saved to sys_file_reference is unique to the DS but not unique to the parent field name context.

Usually we would solve this by extending foreign_match_fields but someone in their infinite wisdom decided that as part of the automatic TCA migration wizard that rewrites type=inline with FAL to type=file, the foreign_match_fields setting should be destroyed and type=file should not have any support whatsoever for this kind of advanced relation criteria.

We are therefore left with only one option: changing the field name of the FAL field to include the parent field name as prefix. This new extension feature enables that behavior.

Unfortunately this means that file references are stored in a completely different way which is not compatible. Changing this extension setting will effectively orphan all existing file relations. You should therefore never change this unless you are setting up a new site, or you plan to migrate all your existing file relations (updating sys_file_reference to set a new fieldname value for every relation matching your set of FAL field names throughout all templates).

Note: the prefix is automatically handled when using transform="file" and other file transform types. But if you use other means of resolving the FAL reference you'll need to manually specify the prefixed version of the fieldname when fetching file relation records.