Skip to content

Commit

Permalink
[BUGFIX] Do not link l18n_cfg restricted pages
Browse files Browse the repository at this point in the history
Prevent linking a page that is either restricted for the default
language or where any fallback is forbidden.

Resolves: #85063
Releases: master, 8.7
Change-Id: I9dd1f7b5b357c60114f72898ddffa9ecf7305bf2
Reviewed-on: https://review.typo3.org/57345
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Peter Kraume <peter.kraume@gmx.de>
Tested-by: Peter Kraume <peter.kraume@gmx.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
  • Loading branch information
IchHabRecht authored and neufeind committed Jun 24, 2018
1 parent c7f4930 commit c2d1150
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php
Expand Up @@ -53,6 +53,13 @@ public function build(array &$linkDetails, string $linkText, string $target, arr
if (empty($page)) {
throw new UnableToLinkException('Page id "' . $linkDetails['typoLinkParameter'] . '" was not found, so "' . $linkText . '" was not linked.', 1490987336, null, $linkText);
}
$language = empty($page['_PAGES_OVERLAY']) ? 0 : $page['_PAGES_OVERLAY_LANGUAGE'];
if ($language === 0 && GeneralUtility::hideIfDefaultLanguage($page['l18n_cfg'])) {
throw new UnableToLinkException('Default language of page "' . $linkDetails['typoLinkParameter'] . '" is hidden, so "' . $linkText . '" was not linked.', 1529527301, null, $linkText);
}
if ($language > 0 && !isset($page['_PAGES_OVERLAY']) && GeneralUtility::hideIfNotTranslated($page['l18n_cfg'])) {
throw new UnableToLinkException('Fallback to default language of page "' . $linkDetails['typoLinkParameter'] . '" is disabled, so "' . $linkText . '" was not linked.', 1529527488, null, $linkText);
}

if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typolinkProcessing']['typolinkModifyParameterForPageLinks'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typolinkProcessing']['typolinkModifyParameterForPageLinks'] as $classData) {
Expand Down

0 comments on commit c2d1150

Please sign in to comment.