Project

General

Profile

Actions

Bug #47869

closed

Failed localization of FILES content object related to pages

Added by Eugene Skomorokhov almost 11 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Category:
Frontend
Target version:
-
Start date:
2013-05-03
Due date:
% Done:

100%

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

Description

Localization failed when references.table=pages used. The code in typo3/sysext/frontend/Classes/ContentObject/FlowPlayerContentObject.php line 73

if ($table === 'pages' && isset($this->cObj->data['_LOCALIZED_UID']) && intval($this->cObj->data['sys_language_uid']) > 0) {
    $table = 'pages_language_overlay';
}

doesn't working because of $this->cObj->data is NULL.


Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #48113: typoscript FILES object always uses default language when accessing page resource images of translated images Closed2013-05-11

Actions
Related to TYPO3 Core - Bug #58352: Invalid localization overlay of cObject FILESClosedOliver Hader2014-04-30

Actions
Related to TYPO3 Core - Bug #57272: Extbase doesn't handle FAL translations correctlyClosed2014-03-25

Actions
Related to TYPO3 Core - Bug #60998: PageRepository::shouldFieldBeOverlaid raises PHP warningClosed2014-08-15

Actions
Actions #1

Updated by Thorsten Kahler almost 11 years ago

  • Category set to Frontend
  • Status changed from New to Needs Feedback
  • Assignee set to Eugene Skomorokhov

Hi Eugene, I guess you meant line 73 in FilesContentObject.php, didn't you? Could you provide a little bit more elaborated example code, please?

Actions #2

Updated by Alexander Stehlik over 10 years ago

Hi,

I just stumbled over this issue today. I'm not sure if there are other usecases for this but thats the problem I've got:

I'm using the media field to upload images I want to display in a MENU object. Here is some example TypoScript:

page = PAGE
page.10 = HMENU
page.10 {
  1 = TMENU
  1 {
    NO = 1
    NO.wrapItemAndSub = <p>|</p>
    NO.after.cObject = FILES
    NO.after.cObject  {
      references.fieldName = media
      renderObj = IMAGE
      renderObj {
        file.import.data = file:current:uid_local
        file.width = 100
      }
    }
  }
}

The problem as I understand it is indeed the line 77 in \TYPO3\CMS\Frontend\ContentObject\FilesContentObject. The field _LOCALIZED_UID is not available for pages.

The language overlay is done in two different methods in the \TYPO3\CMS\Frontend\Page\PageRepository class:

getPageOverlay() - this is responsible for pages and sets the fields _PAGES_OVERLAY, _PAGES_OVERLAY_UID and _PAGES_OVERLAY_LANGUAGE
getRecordOverlay() - this is responsible for other records and sets the field _LOCALIZED_UID

I modified the code a bit and this seems to work:

$localizedUid = $this->cObj->data['_LOCALIZED_UID'];
if ($table === 'pages' && isset($this->cObj->data['_PAGES_OVERLAY_UID']) && intval($this->cObj->data['_PAGES_OVERLAY_LANGUAGE']) > 0) {
    $table = 'pages_language_overlay';
    $localizedUid = $this->cObj->data['_PAGES_OVERLAY_UID'];
}
$referencesForeignTable = $this->stdWrapValue('table', $conf['references.'], $table);
$referencesForeignUid = $this->stdWrapValue('uid', $conf['references.'], isset($localizedUid) ? $localizedUid : $this->cObj->data['uid']);

If you think this makes sense I'll upload a patch to gerrit.

Cheers,
Alex

Actions #3

Updated by Alexander Opitz over 10 years ago

  • Status changed from Needs Feedback to New

@Alexander Stehlik

I don't know if it make sense, but providing a patch to gerrit is always usefull.

Actions #4

Updated by Philipp Gampe over 10 years ago

It might be a good idea to ping Helmut, as he seemed to have something with l10n in mind for FAL.

Actions #5

Updated by Gerrit Code Review over 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/24884

Actions #6

Updated by Alexander Stehlik over 10 years ago

Sorry, I totally lost track of this one. A patch was submitted to gerrit.

Test environment

To set up a simple test environment for reproducing the error follow these steps

  • in the TYPO3 root create a sys_language record
  • create a new root page
  • create a TypoScript template in that root page and fill the setup section with the value documented below
  • adjust the config.sys_language_uid valid to your environment
  • create a translation for the root page
  • create a subpage
  • set an image in the media section of the subpage
  • create a translation for the subpage
  • set an image (a different one!) in media section the translation of the subpage
  • open the root page in the Frontend and switch the language (append &L=1)

TypoScript template setup

page = PAGE
page.10 = HMENU
page.10 {
  1 = TMENU
  1 {
    NO = 1
    NO.wrapItemAndSub = <p>|</p>
    NO.after.cObject = FILES
    NO.after.cObject  {
      references.fieldName = media
      renderObj = IMAGE
      renderObj {
        file.import.data = file:current:uid_local
        file.width = 100
      }
    }
  }
}

config.sys_language_uid = 0

[globalVar = GP:L = 1]
config.sys_language_uid = 1
[global]

Expected results

The expected result is to see the translated page title of the subpage and the image that was set in the media section of the translation record.

Before the patch is applied the image that was set in the page media section will be displayed.

After the patch the expected image set in the page translation media section is displayed.

Actions #7

Updated by Gerrit Code Review about 10 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/24884

Actions #8

Updated by Gerrit Code Review almost 10 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/24884

Actions #9

Updated by Gianpaolo Scrigna almost 10 years ago

I can confirm the bug. Your patch works perfectly on Typo3 6.1.8
Thanks

Actions #10

Updated by Gerrit Code Review almost 10 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/29739

Actions #11

Updated by Gerrit Code Review almost 10 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/29739

Actions #12

Updated by Gerrit Code Review almost 10 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/24884

Actions #13

Updated by Gerrit Code Review almost 10 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/29739

Actions #14

Updated by Steffen Ritter almost 10 years ago

  • Status changed from Under Review to Resolved
  • Is Regression set to No
Actions #15

Updated by Gerrit Code Review almost 10 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/30666

Actions #16

Updated by Gerrit Code Review almost 10 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/30666

Actions #17

Updated by Gerrit Code Review almost 10 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/30666

Actions #18

Updated by Steffen Ritter almost 10 years ago

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

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF