Bug #48883

Wrong sys_language_uid in sys_file_reference

Added by Heiko Kromm about 6 years ago. Updated 11 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2013-06-05
Due date:
% Done:

100%

TYPO3 Version:
6.1
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I have a domain model, which has a property image, which is a FAL image.
When I create a new element in default language and add a FAL image to this element everything works fine.
If I localize the element the FAL ImageResource will be localized too.

But if I create a new element in non-default language (sys_language_uid = 1) the attached FAL image is not recognized by extbase.
I checked the sys_file_reference table and the entry for the attached FAL image has a sys_language_uid=0. Therefore extbase does not recognize the FAL image. If I change sys_language_uid to 1, which is the sys_language_uid of the parent object ist works.

I think when creating new inline FAL images, the system needs to respect the sys_language_uid of the parent Object.


Related issues

Related to TYPO3 Core - Bug #57272: Extbase doesn't handle FAL translations correctly Closed 2014-03-25
Related to TYPO3 Core - Bug #57063: Parent language is not applied to new child records Closed 2014-03-19
Related to TYPO3 Core - Bug #75040: placeholder pointing to column of related record shows values from wrong language Closed 2016-03-14
Related to TYPO3 Core - Bug #63092: Inline/IRRE records: language field of child records is not updated when modifying parent language field - e.g. problematic for sys_file_reference Rejected 2014-11-20
Related to TYPO3 Core - Bug #76048: IRRE: Child records - New record doesn't get language of parent (non localized records but using new button) Closed 2016-05-04
Related to TYPO3 Core - Bug #59734: Translating a CE containing inline elements doesn't apply language to inline elements New 2014-06-20
Related to TYPO3 Core - Bug #82330: cant create inline records if ctrl > enablecolumns > endtime is not specified in childrens TCA Closed 2017-09-07
Blocked by TYPO3 Core - Bug #21964: New child records created from a translated record have default language Closed 2010-01-15

Associated revisions

Revision c4c2ae46 (diff)
Added by Nicole Cordes over 2 years ago

[BUGFIX] Set language uid for inline children by default

On creating child records for an inline field, currently no language
is set and the children are stored with sys_language_uid 0. This patch
adds the proper configuration to ensure a default children language
according to its parent language.

Resolves: #48883
Resolves: #76048
Resolves: #73609
Releases: master, 7.6
Change-Id: Id9e449dbb06fed11670eedec45a92529fb4acb6f
Reviewed-on: https://review.typo3.org/52061
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Tobi Kretschmann <>
Reviewed-by: Frank Nägler <>
Reviewed-by: Nicole Cordes <>
Tested-by: Nicole Cordes <>

Revision d9e99922 (diff)
Added by Nicole Cordes over 2 years ago

[FOLLOWUP][BUGFIX] Set language uid for inline children by default

Resolves: #48883
Resolves: #76048
Resolves: #73609
Releases: master, 7.6
Change-Id: Id782bd41bfe30d9f9574e4b444d6e361ac76d0c6
Reviewed-on: https://review.typo3.org/52148
Reviewed-by: Wouter Wolters <>
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

Revision 9d3aa861 (diff)
Added by Susanne Moog about 2 years ago

[BUGFIX] Set language uid for inline children by default

On creating child records for an inline field, currently no language
is set and the children are stored with sys_language_uid 0. This patch
adds the proper configuration to ensure a default children language
according to its parent language.

Resolves: #48883
Resolves: #76048
Resolves: #73609
Releases: master, 7.6
Change-Id: Id9e449dbb06fed11670eedec45a92529fb4acb6f
Reviewed-on: https://review.typo3.org/53206
Tested-by: TYPO3com <>
Reviewed-by: Benni Mack <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>
Reviewed-by: Tymoteusz Motylewski <>
Tested-by: Tymoteusz Motylewski <>

History

#1 Updated by Tim Lochmüller about 6 years ago

I can confirm this issue. But I think it is more an IRRE Bug than a FAL related issue?!

#2 Updated by Aske Ertmann almost 6 years ago

Looking a little into this issue I think the reason why it doesn't work in Extbase is because the FAL API doesn't use proper TYPO3 API to get file references. I looks like it would work fine if you use the TypoScript objects to fetch your references because the ContentObjectRenderer's getImgResource uses FAL's ResourceFactory to fetch the file reference. The method getFileReferenceObject in the ResourceFactory uses the page repository's checkRecord method, which does not check language and therefore bypassing the language field. However Extbase uses the it's own SQL parser which follows all the rules defined in the sys_file_reference's ctrl configuration, and therefore adds the language check.

http://api.typo3.org/typo3cms/master/html/_resource_factory_8php_source.html#l00440

So IMO it's related to FAL since FAL bypasses the ctrl configuration, but there are of course more than one solution, either one specifically for Extbase and one for handling languages for sys_file_references property. Thing is though that the references are copied when an element is translated instead of it using the normal inline translation workflow, so maybe it doesn't even make sense to have localized versions of sys_file_references.

#3 Updated by Frans Saris over 5 years ago

  • Is Regression set to No

IMO it is a problem in IRRE as the FAL layer isn't touched when you create a new relation in BE.

#4 Updated by Viktor Livakivskyi over 5 years ago

Added a dependency to an IRRE issue #21964, which is... 4 years old.

#5 Updated by Jan Greth over 5 years ago

I have the exact same behaviour and brings much trouble in multilingual sites...
Does anyone have a clue how to workaround this?

#6 Updated by Helmut Hummel about 5 years ago

  • Status changed from New to Needs Feedback

Can you please check if this issue is fixed for you with the fix applied to #57063

#7 Updated by Patrick Kroog almost 5 years ago

I can confirm that this issue still exists in 6.2.3 (unfortunately can't try out 6.2.4 atm)

1) Create new Parent Record (set sys_language_uid > 0)
2) Create Image-IRRE-Relation (sys_file_reference) -> sys_language_uid field is in hidden palette "filePalette" and of course defaults to value "0" (if no other default value is set)

3) Result: Parent Record has sys_language_uid > 0.. Child Record in sys_file_reference has the value "0" as you can't change it by default...

The problem also still seems to exist for already existing parent records.

@Jan Greth:
For now, one option is to make the palette visible via extTables.php, and then at least be able to configure the sys_language_uid field manually:

$TCA['sys_file_reference']['palettes']['filePalette']['isHiddenPalette'] = 0;

#8 Updated by Alexander Opitz almost 5 years ago

  • Status changed from Needs Feedback to New

#9 Updated by Mathias Schreiber over 3 years ago

  • Category changed from File Abstraction Layer (FAL) to Extbase

#10 Updated by Tymoteusz Motylewski over 2 years ago

But if I create a new element in non-default language (sys_language_uid = 1) the attached FAL image is not recognized by extbase.

Do you create a new record through extbase or backend?
Can you provide a simple test extension and describe steps to reproduce it?

#11 Updated by Gerrit Code Review over 2 years ago

  • Status changed from New 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/52061

#12 Updated by Nicole Cordes over 2 years ago

Steps how to reproduce:

- create a page_language_overall for a page
- insert a new content element "text & media"

case 1:
- save the content element
- add an image to media tab (assets field)
- save the content record again

expectation:
- sys_file_reference record is stored with proper language in sys_language_uid

actual:
- sys_file_reference record is stored with sys_language_uid 0

case 2:
- add an image to media tab (without saving the parent content record)
- save the content record

expectation:
- sys_file_reference record is stored with proper language in sys_language_uid

actual:
- sys_file_reference record is stored with sys_language_uid 0

#13 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#14 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#15 Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#16 Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#17 Updated by Gerrit Code Review over 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#18 Updated by Gerrit Code Review over 2 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#19 Updated by Gerrit Code Review over 2 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#20 Updated by Gerrit Code Review over 2 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#21 Updated by Gerrit Code Review over 2 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52061

#22 Updated by Nicole Cordes over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#23 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Resolved 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/52148

#24 Updated by Nicole Cordes over 2 years ago

  • Status changed from Under Review to Resolved

#25 Updated by Gerrit Code Review about 2 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53205

#26 Updated by Gerrit Code Review about 2 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53206

#27 Updated by Gerrit Code Review about 2 years ago

Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53206

#28 Updated by Gerrit Code Review about 2 years ago

Patch set 3 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53206

#29 Updated by Gerrit Code Review about 2 years ago

Patch set 4 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53206

#30 Updated by Gerrit Code Review about 2 years ago

Patch set 5 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53206

#31 Updated by Anonymous about 2 years ago

  • Status changed from Under Review to Resolved

#32 Updated by Tymoteusz Motylewski about 2 years ago

The backport to v7 has been merged (https://review.typo3.org/#/c/53206/)
Few notes:
1) Now NEW irre elements (including FAL relations) will get a sys_language_uid of their parent.
2) There is no automatic migration of the old record having inccorrect value in the sys_language_uid.
3) The issue has been solved on the FormEngine level, thus you need to make sure you have
sys_language_uid field in the showitem list in your TCA.

Often you don't want to show the sys_language field to the user, so there is a little trick, which will make stuff work without showing the field to the user.
You just need to create a hidden palette with sys_language_uid in it.
e.g.

'showitem' = '... --palette--;;hiddenLanguagePalette,';
'hiddenLanguagePalette' => [
    'showitem' => 'sys_language_uid, l10n_parent',
         'isHiddenPalette' => true,
],

See TCA for sys_file_reference where this approach is used, or this pull request as a reference https://github.com/benjaminkott/bootstrap_package/pull/458

#33 Updated by Mathias Brodala almost 2 years ago

  • Related to Bug #82330: cant create inline records if ctrl > enablecolumns > endtime is not specified in childrens TCA added

#34 Updated by Benni Mack 11 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF