CoreCommunity ExtensionsDistributionsFeature-RequestsTYPO3 6.2 Projects (+)(Archived Projects)

Bug #57021

FAL media files in translated news records don't work

Added by Simon Würstle over 1 year ago. Updated 6 months ago.

Status:Rejected Start date:2014-03-18
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:-
Target version:-
TYPO3 Version:6.2 Branch:
PHP Version:5.4 Complexity:
Has patch:No Is Regression:No

Description

When I translate a news record, no fal media files are copied (no images are displayed in the news record in backend and frontend). When I manually add fal media files in the translated news record, they show up in backend after I save the record, but they don't show up in frontend.

TYPO3 6.2beta7
PHP 5.4
news 3.0.0-dev (latest) with default templates


Related issues

related to Core - Bug #59192: mergeIfNotBlank with FAL records Accepted 2014-05-28
related to Core - Bug #57272: Extbase doesn't handle FAL translations correctly Under Review 2014-03-25

History

#1 Updated by Markus Kasten over 1 year ago

I can confirm that FAL related files aren't translated either.
I have a german news which is translated to english with different related files, but the original (german) related files are displayed in the frontend.

#2 Updated by Georg Ringer over 1 year ago

  • Status changed from New to Needs Feedback

are you testing with really testing master? however this is a core issue and not news issue

#3 Updated by Markus Kasten over 1 year ago

I tested with news master and yesterdays TYPO3 master (since todays generates bad queries), doesn't work.
Probably a core issue though, yes.

#4 Updated by Georg Ringer about 1 year ago

  • Target version deleted (3.0.0)

#5 Updated by Frans Saris 12 months ago

We use ext:news + TYPO3 6.2 + multilanguage and got no problems with the FE.

What language settings do you use?

#6 Updated by Markus Timtner 11 months ago

Frans Saris wrote:

We use ext:news + TYPO3 6.2 + multilanguage and got no problems with the FE.

What language settings do you use?

Same proble exists here.
Standard T3 6.2.4 + tx_news 3.1.0-dev, FAL records in FE are always from the default language.

My settings are:

[root-setup.ts]
config {
    # language
    linkVars = L
    sys_language_mode = content_fallback
    sys_language_overlay = hideNonTranslated

    # default language
    sys_language_uid = 0
    htmlTag_langKey = de
    language = de
    locale_all = de_DE.UTF8
}

# -----------------------------------------------------------------------------
# Translation handling:

# sys_language.uid = 1
[globalVar = GP:L = 1]
    config.sys_language_uid = 1
    config.htmlTag_langKey = en
    config.language = en
    config.locale_all = en_GB

[global]

#7 Updated by Markus Timtner 11 months ago

I helped myself with creating a new Viewhelper;

ext/news/Classes/Viewhelpers/L10nfalimgViewHelper.php

<?php
/*
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */

 /** This Viewhelper is atm necessary to fetch the localised fal images for newsrecords
 *
 *
 * Example
 * ----------
 *    <n:l10nfalimg news="{newsItem}">
 *        <f:for each="{l10nfalimg}" as="falimage" iteration="i">
 *            <a title="{falimage._file.description}" href="{f:uri.image(src:'{falimage._file.publicUrl}' maxWidth:'1360')}" rel="lightbox[{newsItem.uid}]" data-toggle="lightbox">
 *            <f:image 
 *                src="{falimage._file.publicUrl}" 
 *                alt="{f:if(condition: '{falimage._file.alternative}', then: '{falimage._file.alternative}', else: '{falimage._file.title}')}" 
 *                width="{settings.detail.media.image.width}" 
 *                height="{settings.detail.media.image.height}" 
 *                maxWidth="{settings.detail.media.image.maxWidth}" 
 *                maxHeight="{settings.detail.media.image.maxHeight}" 
 *                treatIdAsReference="1" 
 *            />
 *            </a>
 *            <p class="news-single-imgcaption">
 *                <f:format.htmlentitiesDecode>{falimage._file.title}</f:format.htmlentitiesDecode>
 *            </p>
 *            <f:comment>
 *            <f:format.html>
 *                falimage.uid              : {falimage.uid}
 *                falimage.identifier       : {falimage._file.identifier}
 *                falimage.public_url       : {falimage._file.publicUrl}
 *                falimage.name             : {falimage._file.name}
 *                falimage.title            : {falimage._file.title}
 *                falimage.alternative      : {falimage._file.alternative}
 *                falimage.description      : {falimage._file.description}
 *                falimage.extension        : {falimage._file.extension}
 *                falimage.type             : {falimage._file.type}
 *                falimage.mimeType         : {falimage._file.mimeType}
 *                falimage.size             : {falimage._file.size}
 *                falimage.creationTime     : {falimage._file.creationTime}
 *                falimage.modificationTime : {falimage._file.modificationTime}
 *            </f:format.html>
 *            </f:comment>
 *        </f:for>
 *    </n:l10nfalimg>
 *
 *
 */
use TYPO3\CMS\Core\Utility\GeneralUtility;

class Tx_News_ViewHelpers_L10nfalimgViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {

    /**
     * @param Tx_News_Domain_Model_News $newsItem current newsitem
     */

    public function render($news) {

        $where = 'hidden=0 AND deleted=0 AND tablenames="tx_news_domain_model_news" AND fieldname="fal_media" AND uid_foreign=' . (int)$news->_getProperty('_localizedUid');
        $where .= ' ' . \TYPO3\CMS\Backend\Utility\BackendUtility::getWorkspaceWhereClause('sys_file_reference');

        $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_file_reference', $where);
        foreach ($records as &$r) {
            $GLOBALS['TSFE']->sys_page->versionOL('sys_file_reference', $r);
            $fileReferenceData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file_reference', 'uid=' . $r['uid'] . ' AND deleted=0');

            /** @var \TYPO3\CMS\Core\Resource\FileReference $obj */
            $obj =  GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileReference', $fileReferenceData);
            $r['_file'] = $obj;
            $r['_path'] = $obj->getPublicUrl();
        }
        $this->templateVariableContainer->add('l10nfalimg', $records);
        $output = $this->renderChildren();
        $this->templateVariableContainer->remove('l10nfalimg');
        return $output;
    }
}

#8 Updated by rainer karnowski 10 months ago

hey markus ... i have copied your code and load it up but do i have to make something else that it workes ... in my case i do not have any changes happen and i'm looking now so long for a solution for that... can you help ?

#9 Updated by Tanel Põld 9 months ago

Using sys_language_mode = strict FAL images in translations aren't showing up.
TYPO3 6.2.6 and News 3.0.1.

Viewhelper above is very helpful indeed, thanx Markus!

#10 Updated by rainer karnowski 9 months ago

thanks for your solution ... i will use it soon again .

#11 Updated by Karsten Nowak (undkonsorten) 9 months ago

I solved this issues with overriding the TCA of news. No patch and no other viewhelper is needed. With this viewhelper above i can't using the condition of fal_media in fluid.
A little Extension with

$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['fal_media']['config']['appearance']['showSynchronizationLink'] = 1;
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['fal_media']['config']['appearance']['showAllLocalizationLink'] = 1;
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['fal_media']['config']['appearance']['showPossibleLocalizationRecords'] = 1;

adds the buttons to localize fal media records in translated news. Now i can translate the images with the "Localize all" button and the images are shown in frontend. I use sys_language_mode = strict.
When i need images in news records they don't have a record in the default language then it's required to translate the used images in file list module before using in the news.
Then these images are shown also in frontend. The same works for related files.

$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['fal_related_files']['config']['appearance']['showSynchronizationLink'] = 1;
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['fal_related_files']['config']['appearance']['showAllLocalizationLink'] = 1;
$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['fal_related_files']['config']['appearance']['showPossibleLocalizationRecords'] = 1;

I think this TCA settings can be used by default in news.

Abnormal behavior detected. Read here: #57272

#12 Updated by Birger Fuehne 7 months ago

I can confirm this bug with version 6.2.9 and ext:news 3.0.1.
I created an extension as described by Karsten Nowak, which solved the issue for me.

#13 Updated by Urs Braem 7 months ago

Adding (and using) showSynchronizationLink and showAllLocalizationLink "works" in the sense that TYPO3 is displaying an image - but the original image only, not the one selected when localising it. The behaviour is the same as if using sys_language_mode = default instead of sys_language_mode = strict

#14 Updated by Georg Ringer 6 months ago

  • Status changed from Needs Feedback to Rejected

this is an core issue, see #57272

Also available in: Atom PDF