Skip to content

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

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

Conversation

NamelessCoder
Copy link
Member

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.

@NamelessCoder NamelessCoder force-pushed the feature/unique-file-field-name branch from d3b66a0 to 9aa5836 Compare July 13, 2024 15:43
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.
@NamelessCoder NamelessCoder force-pushed the feature/unique-file-field-name branch from 9aa5836 to c8d2cdf Compare July 13, 2024 15:52
@NamelessCoder NamelessCoder merged commit c99218e into FluidTYPO3:development Jul 13, 2024
12 checks passed
@NamelessCoder NamelessCoder deleted the feature/unique-file-field-name branch July 13, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant