Feature #59833

levelmedia translation fallback

Added by Tizian Schmidlin about 5 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2014-06-24
Due date:
% Done:

0%

PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

Description

Hello there,

I recently run into a use case that was not covered by the standard TYPO3 features: translation fallback for levelmedia.

Explanation: we set up a new field for pages that is used to set a banner on the page. This banner may change according to the current page language (since banner may contain text in different languages). Now the customer didn't have the time to replace all the banners on time, so we needed a fallback to the standard translation.

Sadly, this wasn't covered by levelmedia yet, also the l10n_mode 'mergeIfNotBlank' didn't do the trick, so I developed the following patch:

in TYPO3 4.5.x: typo3/sysext/cms/tslib/class.tslib_content.php:5261
in TYPO3 6.2.x: typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:5426

case 'levelfield':
    $keyP = t3lib_div::trimExplode(',', $key);
    $nkey = $this->getKey($keyP[0], $GLOBALS['TSFE']->tmpl->rootLine);
    $rootLine = $GLOBALS['TSFE']->tmpl->rootLine;
    /** cab st: 2014-06-23: add an additional parameter for levelfield so you can take the value from the
     * original page data. If there wasn't any, check the other levels for values. As soon as a value is found, we
     * break the loop.
     */
    if($keyP[3] == 'from_original') {

        for($i = $nkey; $i >= 0; $i--) {
            if(empty($rootLine[$i][$keyP[1]])) {
                // try to get the original
                $newRow = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
                    '*',
                    'pages',
                    'uid = ' . $rootLine[$i]['uid']
                );

                if(!empty($newRow[$keyP[1]])) {
                    $rootLine[$i][$keyP[1]] = $newRow[$keyP[1]];
                    break;
                }                                    
            } else {
                // we already are on a superior level that has content, so no untranslation needed
                break;
            }
        }
    }
    $retVal = $this->rootLineValue($nkey, $keyP[1], strtolower($keyP[2]) == 'slide', $rootLine);
    /** cab st end */
break;

This patch is completely backwards compatible since you have to add a parameter to the levelfield after slide.

Best Regards

Tizian


Related issues

Related to TYPO3 Core - Bug #44312: Sliding levelmedia not working for alternate languages in 6.0.0 Closed 2013-01-04
Related to TYPO3 Core - Bug #65863: content_fallback / mergeIfNotblank fails with content slide, pageOverlayFields is ignored Closed 2015-03-20

History

#1 Updated by Markus Klein about 5 years ago

  • Category set to Content Rendering
  • Target version changed from next-patchlevel to 7.0

Hi Tizian,

can you please push that patch to our review system?

http://wiki.typo3.org/CWT holds information on how to do that.

Thanks

#2 Updated by Frans Saris about 5 years ago

Can't we use any existing param for this? I see this more like a bug then a feature

#3 Updated by Mathias Schreiber over 4 years ago

  • Target version changed from 7.0 to 7.1 (Cleanup)

#4 Updated by Mathias Schreiber over 4 years ago

  • Target version changed from 7.1 (Cleanup) to 7.2 (Frontend)

#5 Updated by Benni Mack over 4 years ago

  • Target version changed from 7.2 (Frontend) to 7.4 (Backend)

#6 Updated by Susanne Moog about 4 years ago

  • Target version changed from 7.4 (Backend) to 7.5

#7 Updated by Benni Mack almost 4 years ago

  • Target version changed from 7.5 to 7 LTS

#8 Updated by Benni Mack almost 4 years ago

  • Target version deleted (7 LTS)

#9 Updated by Oliver Hader almost 4 years ago

  • Status changed from New to Needs Feedback

If #65863 would be solved to support mergeIfNotBlank on these rootline fields, then this very feature would be obsolete, right?

#10 Updated by Alexander Opitz over 3 years ago

  • Status changed from Needs Feedback to Closed

No feedback within the last 90 days => closing this issue.

If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.

Also available in: Atom PDF