Bug #47869
closedFailed localization of FILES content object related to pages
100%
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.
Updated by Thorsten Kahler over 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?
Updated by Alexander Stehlik over 11 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
Updated by Alexander Opitz over 11 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.
Updated by Philipp Gampe over 11 years ago
It might be a good idea to ping Helmut, as he seemed to have something with l10n in mind for FAL.
Updated by Gerrit Code Review about 11 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
Updated by Alexander Stehlik about 11 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.
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gianpaolo Scrigna over 10 years ago
I can confirm the bug. Your patch works perfectly on Typo3 6.1.8
Thanks
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Steffen Ritter over 10 years ago
- Status changed from Under Review to Resolved
- Is Regression set to No
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Steffen Ritter over 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 90b0b4a3973697c2324c5a7ef8eec7db0a23d66e.