Project

General

Profile

Actions

Feature #59833

closed

levelmedia translation fallback

Added by Tizian Schmidlin over 10 years ago. Updated over 8 years ago.

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

0%

Estimated time:
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 2 (0 open2 closed)

Related to TYPO3 Core - Bug #44312: Sliding levelmedia not working for alternate languages in 6.0.0Closed2013-01-04

Actions
Related to TYPO3 Core - Bug #65863: content_fallback / mergeIfNotblank fails with content slide, pageOverlayFields is ignoredClosedJo Hasenau2015-03-20

Actions
Actions #1

Updated by Markus Klein over 10 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

Actions #2

Updated by Frans Saris over 10 years ago

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

Actions #3

Updated by Mathias Schreiber almost 10 years ago

  • Target version changed from 7.0 to 7.1 (Cleanup)
Actions #4

Updated by Mathias Schreiber almost 10 years ago

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

Updated by Benni Mack over 9 years ago

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

Updated by Susanne Moog over 9 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #7

Updated by Benni Mack about 9 years ago

  • Target version changed from 7.5 to 7 LTS
Actions #8

Updated by Benni Mack about 9 years ago

  • Target version deleted (7 LTS)
Actions #9

Updated by Oliver Hader almost 9 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?

Actions #10

Updated by Alexander Opitz over 8 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.

Actions

Also available in: Atom PDF