Bug #65863

Task #79241: Streamline usage of l10n_mode

content_fallback / mergeIfNotblank fails with content slide, pageOverlayFields is ignored

Added by Sigfried Arnold over 3 years ago. Updated 8 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
TypoScript
Start date:
2015-03-20
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I try to output every image referenced in page.media - if a page is translated and there are no images present in "media" i'd expect it to grab the content from the default language. This works perfectly fine for any other field and worked perfectly fine in TYPO3 4.5 LTS but seems to be broken in 6.2 LTS

Those 2 solutions put me closest to what i want to achieve.

Steps to reproduce:
1) put $GLOBALS['TCA']['pages_language_overlay']['columns']['media']['l10n_mode'] = 'mergeIfNotBlank'; in your extTables.php
2) Create a page (a) with some Images in media
3) Create a translation of this page without setting any images
4) Create a subpage (b) of this page without images
5) Create a translation of this subpage without any images
6) output the image

MEDIA = FILES
MEDIA {
    references {
        table = pages
        uid.data = leveluid:-1, slide
        fieldName = media
    }
    begin = 0
    renderObj = COA
    renderObj {
        10 = IMAGE
        10 {
            file {
                import.data = file:current:uid
                treatIdAsReference = 1
            }
        }
    }
}

6) Request Page b in default and translation

This works fine as expected, both show the images form page a

7) add an image to page b without translating it

The image is not on page b either in default nor in translation

8)

Replace the code with this one (this is the solution provided in the wiki http://wiki.typo3.org/File_Abstraction_Layer#How_to_use_.22levelmedia.22_with_6.x_.3F)

MEDIA = FILES
MEDIA {
    references {
        data = levelmedia:-1, slide
    }
    ...
}

Now on both pages a and b the images are shown in default language but in the translation they are not shown on either page.


Related issues

Related to TYPO3 Core - Bug #58352: Invalid localization overlay of cObject FILES Resolved 2014-04-30
Related to TYPO3 Core - Bug #48113: typoscript FILES object always uses default language when accessing page resource images of translated images Closed 2013-05-11
Related to TYPO3 Core - Bug #19718: Typoscript: CONTENT | slide: multilanguage not correctly respected in content_fallback mode Accepted 2008-12-18
Related to TYPO3 Core - Feature #59833: levelmedia translation fallback Closed 2014-06-24
Related to TYPO3 Core - Bug #63353: Media Relation from translated page properties in a workspace Under Review 2014-11-26
Related to TYPO3 Core - Bug #78743: Wrong translation behavior for pages/pages_language_overlay New 2016-11-18

History

#1 Updated by Sigfried Arnold over 3 years ago

Forgot to mention - is is also reproduceable with a custom extension which extends the pages and pages_language_overlay tables

#2 Updated by Christian von Holten over 3 years ago

Same for me. Settings in localconf is:

'pageOverlayFields' => 'uid,title,subtitle,nav_title,keywords,description,abstract,author,author_email,url,urltype,shortcut,shortcut_mode',

It is without media.

Translated Pages should get image from default language by this code:

10 = IMAGE
10 {
wrap = |
required = 1
file {
import = uploads/media/
import.field = media
import.listNum = 0
treatIdAsReference = 1
width = 275c
height = 160c
ext = jpg
}

In TYPO3 6.2.3 it worked. But now, in TYPO3 6.2.11 no image is shown in translated pages

#3 Updated by Markus Klein over 3 years ago

We just merged a patch in 6.2 that might be related. Can you please check, if this solves the problem for you?
https://review.typo3.org/37940/

#4 Updated by Christian von Holten over 3 years ago

The patch does not make any difference to me

#5 Updated by Markus Klein over 3 years ago

I tried to reproduce this on current master.
I used the TS from 8) and everything works like expected. The image assigned to page A (default lang) is shown on all page and language combinations.

So it seems to be an issue on 6.2 only. Didn't verify things there yet.

#6 Updated by Sigfried Arnold over 3 years ago

i'm not at work anymore so i can't verify this at the moment, but i'm pretty sure this worked already - so i assume Christian van Holten could be right, that this worked in 6.2.3 and is now broken

i'll test this on monday to check if there is any difference with different versions of 6.2

also as i mentionend "pageOverlayFields" seems to be ignored in LocalConfiguration.php - if you empty it completely it makes no difference and the overlay for all other fields will still work - as far as i understand the related code, not all of the default configuration is overwritten by LocalConfiguration.php - but by an AdditionalConfiguration.php - this is pretty wierd and intransparent and does not seem to work in this case either - if some values are removed form the default file in the core, the override stops working - but in either case, there is no effect if you remove "media" or not (which was the solution we used in TYPO3 4.5)

#7 Updated by Sigfried Arnold over 3 years ago

i've no isolated the problem - i checked this 6.2.10, 6.2.11 and 6.2.3 - i have not checked other versions

media is present in pageOverlayFields
l10n_mode is set to mergeIfNotBlank
references are collected with data = levelmedia:-1, slide

same as before, page a and b where a is translated with images and b is not

if you request page b in translation you get the image set in the translation of page a and not the image in the default language of page b

it seems the slide is done before the overlay - if you remove media from overlay fields it is not overlayed, but the slide works as expected

with the same code (without references/fal) this worked in 4.5

this is not a big issue with smaller sites with a few translations, but if you have a huge site with lots of translations, this is really PITA for the editor


Edit: i've found an old issue, which did in principle the same with tt_content records #19718

#8 Updated by Christoph Lehmann almost 3 years ago

Overlaying the media field in 6.2.14 works!

I used

$GLOBALS['TCA']['pages_language_overlay']['columns']['media']['l10n_mode'] = 'mergeIfNotBlank';

AND

page = PAGE
page.10 = FILES
page.10 {
    references {
        table = pages
        uid.data = leveluid:-1, slide
        fieldName = media
    }
    begin = 0
    renderObj = COA
    renderObj {
        10 = IMAGE
        10 {
            file {
                import.data = file:current:uid
                treatIdAsReference = 1
            }
        }
    }
}

#9 Updated by Andreas Allacher almost 3 years ago

Using levelmedia, however, still doesn't work but at least the code above works

#10 Updated by Markus Klein almost 3 years ago

@Andreas: Can you fix that?

#11 Updated by Andreas Allacher almost 3 years ago

Will try to look into it as I need it anyway.
If I am able to fix it, I will post a patch.
Otherwise I will let you know.

Also leveluid doesn't do the same as levelmedia because it only slides until it finds an uid which should be pretty soon :)

Sorry for response delay but I forgot to add ticket to watch list.

#12 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/41720

#13 Updated by Gerrit Code Review almost 3 years ago

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/41720

#14 Updated by Oliver Hader over 2 years ago

  • Status changed from Under Review to Needs Feedback
  • Priority changed from Must have to Should have

Patch in Gerrit has been abandoned for whatever reason. This issue still seems to be valid...

#15 Updated by Alexander Opitz over 2 years ago

  • Status changed from Needs Feedback to New
  • Target version set to Candidate for patchlevel

#16 Updated by Jo Hasenau over 2 years ago

  • Category set to TypoScript
  • Status changed from New to Accepted
  • Assignee set to Jo Hasenau

Just to clarify the expected behaviour for this one:

You want to use levelmedia together with language overlays.
Now the rootline must be traversed until an image is found either

a) in the language overlay of a page within that rootline or
b) in the default language of that page

So IMHO it would be useful to merge the overlay and default language records before traversing the rootline according to the settings.

With "mergeIfNotBlank" set there might still be images of the default language in the rootline for each page, that does not have an overlaid image.

Without it, even the empty translation values would be overlaid.
So the rootline might have less images, and pages with empty values will be skipped.

#17 Updated by Jo Hasenau over 2 years ago

  • Status changed from Accepted to Needs Feedback

It seems that overlays are already merged correctly within the RootlineUtility class. So if levelmedia still does not return correct images, the problem must be somewhere else.

#18 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Needs Feedback 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/47041

#19 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/47041

#20 Updated by Xavier Perseguers almost 2 years ago

Confirming this bug in TYPO3 6.2 and the trick with

references {
    table = pages
    uid.data = leveluid:-1, slide
    fieldName = media
}

instead of

references {
    data = levelmedia:-1, slide
}

No need to change the TCA.

#21 Updated by Riccardo De Contardi over 1 year ago

  • Parent task set to #79241

#22 Updated by Benni Mack 8 months ago

  • Status changed from Under Review to Closed

fixed with v8 and v9.

Also available in: Atom PDF