|
diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
|
|
index b16bd1e..cda3cdb 100644
|
|
--- a/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
|
|
+++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Storage/Typo3DbBackend.php
|
|
@@ -823,7 +823,9 @@ class Typo3DbBackend implements BackendInterface, \TYPO3\CMS\Core\SingletonInter
|
|
) {
|
|
if (in_array($row[$GLOBALS['TCA'][$tableName]['ctrl']['languageField']], array(-1, 0))) {
|
|
$overlayMode = $querySettings->getLanguageMode() === 'strict' ? 'hideNonTranslated' : '';
|
|
- $row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode);
|
|
+ // gridds replaced (one line)
|
|
+ // $row = $pageRepository->getRecordOverlay($tableName, $row, $querySettings->getLanguageUid(), $overlayMode);
|
|
+ $row = $pageRepository->getRecordOverlayWithoutFallback($tableName, $row, $querySettings->getSysLanguageUid(), $overlayMode);
|
|
}
|
|
}
|
|
if ($row !== NULL && is_array($row)) {
|
|
diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
|
|
index dddd02e..379cc50 100644
|
|
--- a/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
|
|
+++ b/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php
|
|
@@ -83,7 +83,30 @@ class ContentContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractCon
|
|
if ($conf['table'] == 'pages') {
|
|
$row = $GLOBALS['TSFE']->sys_page->getPageOverlay($row);
|
|
} else {
|
|
- $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
|
|
+ // gridds removed (one line)
|
|
+ // $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($conf['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
|
|
+
|
|
+ // gridds added (start)
|
|
+
|
|
+ $fallbackChain = NULL;
|
|
+ if (isset($conf['languageFallbackChain'])) {
|
|
+ $fallbackChain = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(
|
|
+ ',', $conf['languageFallbackChain']
|
|
+ );
|
|
+ }
|
|
+
|
|
+ $pageLanguageBinding = TRUE;
|
|
+ if (isset($conf['respectPageLanguageBinding']) &&
|
|
+ $conf['respectPageLanguageBinding'] == '0'
|
|
+ ) {
|
|
+ $pageLanguageBinding = FALSE;
|
|
+ }
|
|
+
|
|
+ $row = $GLOBALS['TSFE']->sys_page->getRecordOverlayWithFallback(
|
|
+ $conf['table'], $row, NULL, NULL, $fallbackChain, $pageLanguageBinding
|
|
+ );
|
|
+ // gridds added (end)
|
|
+
|
|
}
|
|
}
|
|
// Might be unset in the sys_language_contentOL
|
|
diff --git a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
|
|
index 40f83ad..b19d0d2 100644
|
|
--- a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
|
|
+++ b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
|
|
@@ -994,7 +994,10 @@ class AbstractMenuContentObject {
|
|
$tok = TRUE;
|
|
// There is an alternative language active AND the current page requires a translation:
|
|
if ($GLOBALS['TSFE']->sys_language_uid && GeneralUtility::hideIfNotTranslated($data['l18n_cfg'])) {
|
|
- if (!$data['_PAGES_OVERLAY']) {
|
|
+ // gridds removed (one line)
|
|
+ // if (!$data['_PAGES_OVERLAY']) {
|
|
+ // gridds added (one line)
|
|
+ if (!$data['_PAGES_OVERLAY'] || ($data['_PAGES_OVERLAY_LANGUAGE'] != $data['sys_language_uid'])) {
|
|
$tok = FALSE;
|
|
}
|
|
}
|
|
@@ -1880,7 +1883,9 @@ class AbstractMenuContentObject {
|
|
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resource)) {
|
|
$this->sys_page->versionOL('tt_content', $row);
|
|
if ($GLOBALS['TSFE']->sys_language_contentOL && $basePageRow['_PAGES_OVERLAY_LANGUAGE']) {
|
|
- $row = $this->sys_page->getRecordOverlay('tt_content', $row, $basePageRow['_PAGES_OVERLAY_LANGUAGE'], $GLOBALS['TSFE']->sys_language_contentOL);
|
|
+ // gridds replaced (one line)
|
|
+ // $row = $this->sys_page->getRecordOverlay('tt_content', $row, $basePageRow['_PAGES_OVERLAY_LANGUAGE'], $GLOBALS['TSFE']->sys_language_contentOL);
|
|
+ $row = $this->sys_page->getRecordOverlayWithFallback('tt_content', $row, $basePageRow['_PAGES_OVERLAY_LANGUAGE']);
|
|
}
|
|
if ($this->mconf['sectionIndex.']['type'] !== 'all') {
|
|
$doIncludeInSectionIndex = $row['sectionIndex'] >= 1;
|
|
diff --git a/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php
|
|
index e130814..25489a4 100644
|
|
--- a/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php
|
|
+++ b/typo3/sysext/frontend/Classes/ContentObject/RecordsContentObject.php
|
|
@@ -97,7 +97,39 @@ class RecordsContentObject extends AbstractContentObject {
|
|
if ($val['table'] === 'pages') {
|
|
$row = $GLOBALS['TSFE']->sys_page->getPageOverlay($row);
|
|
} else {
|
|
- $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
|
|
+ // gridds removed (one line)
|
|
+ // $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay($val['table'], $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
|
|
+
|
|
+ // gridds added (start)
|
|
+
|
|
+
|
|
+ $fallbackChain = NULL;
|
|
+ if (isset($conf['languageFallbackChain'])) {
|
|
+ $fallbackChain = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(
|
|
+ ',', $conf['languageFallbackChain']
|
|
+ );
|
|
+ }
|
|
+
|
|
+ $pageLanguageBinding = TRUE;
|
|
+ if (isset($conf['respectPageLanguageBinding']) &&
|
|
+ $conf['respectPageLanguageBinding'] == '0'
|
|
+ ) {
|
|
+ $pageLanguageBinding = FALSE;
|
|
+ }
|
|
+
|
|
+ $row = $GLOBALS['TSFE']->sys_page->getRecordOverlayWithFallback(
|
|
+ $conf['table'], $row, NULL, NULL, $fallbackChain, $pageLanguageBinding
|
|
+ );
|
|
+
|
|
+
|
|
+
|
|
+ // gridds added (end)
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
}
|
|
}
|
|
}
|
|
diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
|
|
index 8129870..aa318ab 100644
|
|
--- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
|
|
+++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
|
|
@@ -657,6 +657,28 @@ class TypoScriptFrontendController {
|
|
*/
|
|
public $sys_language_content = 0;
|
|
|
|
+
|
|
+ // gridds added (start)
|
|
+
|
|
+ /**
|
|
+ * Contains the prioritized language fallback chain
|
|
+ *
|
|
+ * @var array
|
|
+ */
|
|
+ public $languageFallbackChain = array();
|
|
+
|
|
+ /**
|
|
+ * Contains the prioritized language fallback chain for the current page
|
|
+ *
|
|
+ * @var array
|
|
+ */
|
|
+ public $languageFallbackChainWithPageLanguageBinding = array();
|
|
+
|
|
+
|
|
+ // gridds added (end)
|
|
+
|
|
+
|
|
+
|
|
/**
|
|
* Site content overlay flag; If set - and sys_language_content is > 0 - ,
|
|
* records selected will try to look for a translation pointing to their uid. (If
|
|
@@ -2730,11 +2752,24 @@ class TypoScriptFrontendController {
|
|
$this->initLLvars();
|
|
|
|
// Get values from TypoScript:
|
|
- $this->sys_language_uid = ($this->sys_language_content = (int)$this->config['config']['sys_language_uid']);
|
|
- list($this->sys_language_mode, $sys_language_content) = GeneralUtility::trimExplode(';', $this->config['config']['sys_language_mode']);
|
|
+
|
|
+ // gridds removed (start)
|
|
+ // $this->sys_language_uid = ($this->sys_language_content = (int)$this->config['config']['sys_language_uid']);
|
|
+ // list($this->sys_language_mode, $sys_language_content) = GeneralUtility::trimExplode(';', $this->config['config']['sys_language_mode']);
|
|
+ // gridds removed (end)
|
|
+
|
|
+ // gridds added (start)
|
|
+$this->sys_language_uid = $this->sys_language_content = intval($this->config['config']['sys_language_uid']);
|
|
+list($this->sys_language_mode, $_) = GeneralUtility::trimExplode(';', $this->config['config']['sys_language_mode']);
|
|
+$languageFallbackChain = GeneralUtility::intExplode(',', $this->config['config']['languageFallbackChain']);
|
|
+ // gridds added (end)
|
|
+
|
|
$this->sys_language_contentOL = $this->config['config']['sys_language_overlay'];
|
|
// If sys_language_uid is set to another language than default:
|
|
- if ($this->sys_language_uid > 0) {
|
|
+
|
|
+ // gridds replaced (one line)
|
|
+ // if ($this->sys_language_uid > 0) {
|
|
+ if ($this->sys_language_uid) {
|
|
// check whether a shortcut is overwritten by a translated page
|
|
// we can only do this now, as this is the place where we get
|
|
// to know about translations
|
|
@@ -2753,14 +2788,42 @@ class TypoScriptFrontendController {
|
|
$this->pageNotFoundAndExit('Page is not available in the requested language (strict).');
|
|
break;
|
|
case 'content_fallback':
|
|
- $fallBackOrder = GeneralUtility::intExplode(',', $sys_language_content);
|
|
- foreach ($fallBackOrder as $orderValue) {
|
|
- if ((string)$orderValue === '0' || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
|
|
- $this->sys_language_content = $orderValue;
|
|
- // Setting content uid (but leaving the sys_language_uid)
|
|
- break;
|
|
- }
|
|
- }
|
|
+ // gridds removed (start)
|
|
+ // $fallBackOrder = GeneralUtility::intExplode(',', $sys_language_content);
|
|
+ // foreach ($fallBackOrder as $orderValue) {
|
|
+ // if ((string)$orderValue === '0' || count($this->sys_page->getPageOverlay($this->id, $orderValue))) {
|
|
+ // $this->sys_language_content = $orderValue;
|
|
+ // // Setting content uid (but leaving the sys_language_uid)
|
|
+ // break;
|
|
+ // }
|
|
+ // }
|
|
+
|
|
+ // gridds added (start)
|
|
+
|
|
+
|
|
+ // default is to fallback to default language
|
|
+ $this->sys_language_content = 0;
|
|
+
|
|
+ foreach ($languageFallbackChain as $languageId) {
|
|
+ // ignore default language
|
|
+ if ($this->sys_language_uid === $languageId || $languageId <= 0) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ $pageOverlay = $this->sys_page->getPageOverlay($this->id, $languageId);
|
|
+ if (count($pageOverlay)) {
|
|
+ // Setting content uid (but leaving the sys_language_uid)
|
|
+ $this->sys_language_content = $languageId;
|
|
+ // Remove all fields from page overlay which do not exist in $this->page
|
|
+ $pageOverlay = array_intersect_key($pageOverlay, $this->page);
|
|
+ // overlay page with existing page overlay
|
|
+ $this->page = array_merge($this->page, $pageOverlay);
|
|
+
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // gridds added (end)
|
|
break;
|
|
case 'ignore':
|
|
$this->sys_language_content = $this->sys_language_uid;
|
|
@@ -2768,18 +2831,71 @@ class TypoScriptFrontendController {
|
|
default:
|
|
// Default is that everything defaults to the default language...
|
|
$this->sys_language_uid = ($this->sys_language_content = 0);
|
|
+ // gridds added (one line)
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
// Setting sys_language if an overlay record was found (which it is only if a language is used)
|
|
- $this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
|
|
+ // gridds removed (one line)
|
|
+ // $this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
|
|
+
|
|
+
|
|
+
|
|
+ // gridds added (start)
|
|
+
|
|
+
|
|
+ // Remove all fields from page overlay which do not exist in $this->page
|
|
+ $olRec = array_intersect_key($olRec, $this->page);
|
|
+
|
|
+ // overlay page with existing page overlay
|
|
+ $this->page = array_merge($this->page, $olRec);
|
|
+
|
|
+ // gridds added (end)
|
|
}
|
|
+
|
|
+
|
|
+ // gridds added (start)
|
|
+ // calculate the language fallback chains
|
|
+ if ($this->sys_language_mode === 'content_fallback') {
|
|
+ $this->languageFallbackChain = $languageFallbackChain;
|
|
+ foreach ($languageFallbackChain as $languageId) {
|
|
+ // ignore default language
|
|
+ if ($this->sys_language_uid === $languageId) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ $this->languageFallbackChain[] = $languageId;
|
|
+ if (count($this->sys_page->getPageOverlay($this->id, $languageId))) {
|
|
+ $this->languageFallbackChainWithPageLanguageBinding[] = $languageId;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // gridds added (end)
|
|
+
|
|
+
|
|
+
|
|
+
|
|
}
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
// Setting sys_language_uid inside sys-page:
|
|
$this->sys_page->sys_language_uid = $this->sys_language_uid;
|
|
+ // gridds removed (start)
|
|
+ // // If default translation is not available:
|
|
+ // if ((!$this->sys_language_uid || !$this->sys_language_content) && GeneralUtility::hideIfDefaultLanguage($this->page['l18n_cfg'])) {
|
|
+ // gridds removed (end)
|
|
+
|
|
+ // gridds added (start)
|
|
+
|
|
// If default translation is not available:
|
|
- if ((!$this->sys_language_uid || !$this->sys_language_content) && GeneralUtility::hideIfDefaultLanguage($this->page['l18n_cfg'])) {
|
|
+ if ((!$this->sys_language_uid || !$this->sys_language_content) && $this->page['l18n_cfg'] & 1) {
|
|
+
|
|
+ // gridds added (end)
|
|
$message = 'Page is not available in default language.';
|
|
GeneralUtility::sysLog($message, 'cms', GeneralUtility::SYSLOG_SEVERITY_ERROR);
|
|
$this->pageNotFoundAndExit($message);
|
|
diff --git a/typo3/sysext/frontend/Classes/Page/PageRepository.php b/typo3/sysext/frontend/Classes/Page/PageRepository.php
|
|
index 9d44964..a7ef85b 100644
|
|
--- a/typo3/sysext/frontend/Classes/Page/PageRepository.php
|
|
+++ b/typo3/sysext/frontend/Classes/Page/PageRepository.php
|
|
@@ -16,6 +16,9 @@ namespace TYPO3\CMS\Frontend\Page;
|
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
use TYPO3\CMS\Core\Versioning\VersionState;
|
|
+// gridds added (one line)
|
|
+use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
|
|
+
|
|
|
|
/**
|
|
* Page functions, a lot of sql/pages-related functions
|
|
@@ -341,7 +344,14 @@ class PageRepository {
|
|
*/
|
|
public function getPageOverlay($pageInput, $lUid = -1) {
|
|
// Initialize:
|
|
+
|
|
+ // gridds added (one line)
|
|
+ $noSpecialLanguageRequested = FALSE;
|
|
+
|
|
if ($lUid < 0) {
|
|
+ // gridds added (one line)
|
|
+ $noSpecialLanguageRequested = TRUE;
|
|
+
|
|
$lUid = $this->sys_language_uid;
|
|
}
|
|
$row = NULL;
|
|
@@ -367,6 +377,22 @@ class PageRepository {
|
|
$page_id = $pageInput;
|
|
}
|
|
if (count($fieldArr)) {
|
|
+ // gridds added (start)
|
|
+ $languageClause = 'sys_language_uid=' . intval($lUid) . ' ';
|
|
+
|
|
+ $languageList = array();
|
|
+ if ($noSpecialLanguageRequested) {
|
|
+ $languageList = array_unique(array_merge(
|
|
+ array($lUid),
|
|
+ $GLOBALS['TSFE']->languageFallbackChain,
|
|
+ array($GLOBALS['TSFE']->sys_language_content)
|
|
+ ));
|
|
+
|
|
+ $languageIds = implode(',', array_map('intval', $languageList));
|
|
+ $languageClause = 'sys_language_uid IN (' . $languageIds . ') ';
|
|
+ }
|
|
+ // gridds added (end)
|
|
+
|
|
// NOTE to enabledFields('pages_language_overlay'):
|
|
// Currently the showHiddenRecords of TSFE set will allow
|
|
// pages_language_overlay records to be selected as they are
|
|
@@ -374,9 +400,47 @@ class PageRepository {
|
|
// However you may argue that the showHiddenField flag should
|
|
// determine this. But that's not how it's done right now.
|
|
// Selecting overlay record:
|
|
- $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fieldArr), 'pages_language_overlay', 'pid=' . (int)$page_id . '
|
|
- AND sys_language_uid=' . (int)$lUid . $this->enableFields('pages_language_overlay'), '', '', '1');
|
|
- $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
|
|
+
|
|
+ // gridds removed (start)
|
|
+ // $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', $fieldArr), 'pages_language_overlay', 'pid=' . (int)$page_id . '
|
|
+ // AND sys_language_uid=' . (int)$lUid . $this->enableFields('pages_language_overlay'), '', '', '1');
|
|
+ // $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
|
|
+ // gridds removed (end)
|
|
+
|
|
+ // gridds added (start)
|
|
+ if (!in_array('sys_language_uid', $fieldArr)) {
|
|
+ $fieldArr[] = 'sys_language_uid';
|
|
+ }
|
|
+ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
|
|
+ implode(',', $fieldArr),
|
|
+ 'pages_language_overlay',
|
|
+ 'pid=' . intval($page_id) .
|
|
+ ' AND ' . $languageClause .
|
|
+ $this->enableFields('pages_language_overlay'),
|
|
+ '',
|
|
+ '',
|
|
+ 2
|
|
+ );
|
|
+
|
|
+ if ($noSpecialLanguageRequested) {
|
|
+ // Fetch the row and prefer the most recent in the fallback priority list starting with the lUid
|
|
+ $firstRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
|
|
+ $secondRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
|
|
+ foreach ($languageList as $languageId) {
|
|
+ if ($firstRow['sys_language_uid'] == $languageId) {
|
|
+ $row = $firstRow;
|
|
+ break;
|
|
+
|
|
+ } elseif ($secondRow['sys_language_uid'] == $languageId) {
|
|
+ $row = $secondRow;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ } else {
|
|
+ $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
|
|
+ }
|
|
+ // gridds added (end)
|
|
+
|
|
$GLOBALS['TYPO3_DB']->sql_free_result($res);
|
|
$this->versionOL('pages_language_overlay', $row);
|
|
if (is_array($row)) {
|
|
@@ -408,19 +472,103 @@ class PageRepository {
|
|
}
|
|
}
|
|
|
|
- /**
|
|
- * Creates language-overlay for records in general (where translation is found
|
|
- * in records from the same table)
|
|
- *
|
|
- * @param string $table Table name
|
|
- * @param array $row Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
|
|
- * @param integer $sys_language_content Pointer to the sys_language uid for content on the site.
|
|
- * @param string $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is FALSE)
|
|
- * @throws \UnexpectedValueException
|
|
- * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
|
|
- * @todo Define visibility
|
|
- */
|
|
- public function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '') {
|
|
+// gridds added (start)
|
|
+
|
|
+
|
|
+ /**
|
|
+ * Creates a language overlay for records stored inside tables which contain the
|
|
+ * translation information themselves. In addition to getRecordOverlay this method
|
|
+ * also checks for specified content language fallbacks and includes them.
|
|
+ *
|
|
+ * @param string $table Table name
|
|
+ * @param array $row Record to overlay. Must contain uid, pid and $table]['ctrl']['languageField']
|
|
+ * @param integer|null $sys_language_content Pointer to the sys_language uid for content on the site.
|
|
+ * @param string|null $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is FALSE)
|
|
+ * @param array|null $fallbackList ordered fallback list of language ids
|
|
+ * @param bool $pageLanguageBinding use page language binding for the language fallback chain (only used if fallbackList is NULL)
|
|
+ * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
|
|
+ */
|
|
+ public function getRecordOverlayWithFallback(
|
|
+ $table, $row, $sys_language_content = NULL, $OLmode = NULL, $fallbackList = NULL, $pageLanguageBinding = TRUE
|
|
+ ) {
|
|
+ /** @var TypoScriptFrontendController $tsfe */
|
|
+ $tsfe = $GLOBALS['TSFE'];
|
|
+ $sys_language_content = ($sys_language_content !== NULL ? $sys_language_content : $tsfe->sys_language_content);
|
|
+ $OLmode = ($OLmode !== NULL ? $OLmode: $tsfe->sys_language_contentOL);
|
|
+ if ($fallbackList === NULL) {
|
|
+ $fallbackList = $tsfe->languageFallbackChainWithPageLanguageBinding;
|
|
+ if (!$pageLanguageBinding) {
|
|
+ $fallbackList = $tsfe->languageFallbackChain;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ $record = $this->getRecordOverlayWithoutFallback($table, $row, $sys_language_content, $OLmode);
|
|
+ if (!is_array($record) || !isset($record['_LOCALIZED_UID'])) {
|
|
+ if (count($fallbackList) && $sys_language_content && $OLmode !== 'hideNonTranslated') {
|
|
+ foreach ($fallbackList as $fallbackId) {
|
|
+ $record = $this->getRecordOverlayWithoutFallback($table, $row, $fallbackId, $OLmode);
|
|
+ if (is_array($record) && isset($record['_LOCALIZED_UID'])) {
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ return $record;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Creates a language overlay for records stored inside tables which contain the
|
|
+ * translation information themselves.
|
|
+ *
|
|
+ * @param string $table Table name the record comes from
|
|
+ * @param array $row Record to overlay. Must contain the columns uid, pid and $TCA[$table]['ctrl']['languageField']
|
|
+ * @param integer $sys_language_content Pointer to the sys_language uid to use for content.
|
|
+ * @param string $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is FALSE)
|
|
+ * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
|
|
+ * @deprecated since 6.2; will be removed two versions later
|
|
+ */
|
|
+ public function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '') {
|
|
+ GeneralUtility::logDeprecatedFunction();
|
|
+ return $this->getRecordOverlayWithoutFallback($table, $row, $sys_language_content, $OLmode);
|
|
+ }
|
|
+
|
|
+
|
|
+
|
|
+// gridds added (end)
|
|
+
|
|
+
|
|
+// gridds removed (start)
|
|
+// /**
|
|
+// * Creates language-overlay for records in general (where translation is found
|
|
+// * in records from the same table)
|
|
+// *
|
|
+// * @param string $table Table name
|
|
+// * @param array $row Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
|
|
+// * @param integer $sys_language_content Pointer to the sys_language uid for content on the site.
|
|
+// * @param string $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is FALSE)
|
|
+// * @throws \UnexpectedValueException
|
|
+// * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
|
|
+// * @todo Define visibility
|
|
+// */
|
|
+// public function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '') {
|
|
+// gridds removed (end)
|
|
+
|
|
+// gridds added (start)
|
|
+
|
|
+ /**
|
|
+ * Creates a language overlay for records stored inside tables which contain the
|
|
+ * translation information themselves.
|
|
+ *
|
|
+ * @throws \UnexpectedValueException
|
|
+ * @param string $table Table name the record comes from
|
|
+ * @param array $row Record to overlay. Must contain the columns uid, pid and $TCA[$table]['ctrl']['languageField']
|
|
+ * @param integer $sys_language_content Pointer to the sys_language uid to use for content.
|
|
+ * @param string $OLmode Overlay mode. If "hideNonTranslated" then records without translation will not be returned translated but unset (and return value is FALSE)
|
|
+ * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return FALSE if no translation is found.
|
|
+ */
|
|
+ public function getRecordOverlayWithoutFallback($table, $row, $sys_language_content, $OLmode) {
|
|
+
|
|
+// gridds added (end)
|
|
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'])) {
|
|
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getRecordOverlay'] as $classRef) {
|
|
$hookObject = GeneralUtility::getUserObj($classRef);
|
|
diff --git a/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php b/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php
|
|
index b97d23e..1fb8e5a 100644
|
|
--- a/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php
|
|
+++ b/typo3/sysext/frontend/Tests/Unit/ContentObject/Menu/AbstractMenuContentObjectTest.php
|
|
@@ -92,7 +92,10 @@ class AbstractMenuContentObjectTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
|
|
$this->fixture->sys_page->expects($this->once())->method('getPage')->will($this->returnValue(array('_PAGES_OVERLAY_LANGUAGE' => 1)));
|
|
$this->fixture->parent_cObj->expects($this->once())->method('exec_getQuery')->will($this->returnValue(1));
|
|
$GLOBALS['TYPO3_DB']->expects($this->exactly(2))->method('sql_fetch_assoc')->will($this->onConsecutiveCalls($this->returnValue(array('uid' => 0, 'header' => 'NOT_OVERLAID')), $this->returnValue(FALSE)));
|
|
- $this->fixture->sys_page->expects($this->once())->method('getRecordOverlay')->will($this->returnValue(array('uid' => 0, 'header' => 'OVERLAID')));
|
|
+ // gridds removed (one line)
|
|
+ // $this->fixture->sys_page->expects($this->once())->method('getRecordOverlay')->will($this->returnValue(array('uid' => 0, 'header' => 'OVERLAID')));
|
|
+ // gridds added (one line)
|
|
+ $this->fixture->sys_page->expects($this->once())->method('getRecordOverlayWithFallback')->will($this->returnValue(array('uid' => 0, 'header' => 'OVERLAID')));
|
|
$result = $this->fixture->_call('sectionIndex', 'field');
|
|
$this->assertEquals($result[0]['title'], 'OVERLAID');
|
|
}
|
|
diff --git a/typo3/sysext/t3editor/res/tsref/tsref.xml b/typo3/sysext/t3editor/res/tsref/tsref.xml
|
|
index d15d240..0c880ea 100644
|
|
--- a/typo3/sysext/t3editor/res/tsref/tsref.xml
|
|
+++ b/typo3/sysext/t3editor/res/tsref/tsref.xml
|
|
@@ -1002,6 +1002,18 @@ ignore - The system will stay with the selected language even if the page is not
|
|
<default><![CDATA[
|
|
]]></default>
|
|
</property>
|
|
+
|
|
+<!-- gridds added (start) -->
|
|
+
|
|
+<property name="languageFallbackChain" type="string">
|
|
+ <description><![CDATA[Ordered Comma-separated list of language ids for the language fallback.]]></description>
|
|
+ <default><![CDATA[
|
|
+]]></default>
|
|
+</property>
|
|
+
|
|
+<!-- gridds added (end) -->
|
|
+
|
|
+
|
|
<property name="sys_language_overlay" type="string">
|
|
<description><![CDATA[boolean / keyword
|
|
If set, records from certain tables selected by the CONTENT cObject using the "languageField" setting will select the default language (0) instead of any language set by sys_language_uid / sys_language_mode. In addition the system will look for a translation of the selected record and overlay configured fields.
|