Commit 9fb7ee7c authored by Kevin Ditscheid's avatar Kevin Ditscheid

[BUGFIX] Fix gridelements child record languagevisibility check

parent c4f5c5ae
......@@ -26,13 +26,17 @@ namespace TYPO3\Languagevisibility\Hook;
***************************************************************/
use Exception;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException;
use TYPO3\CMS\Core\Context\Exception\AspectNotFoundException;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\Languagevisibility\Exception\TableNotSupportedException;
use TYPO3\Languagevisibility\Service\FrontendServices;
use TYPO3\Languagevisibility\Service\VisibilityService;
/**
* Class PageHook
......@@ -110,6 +114,24 @@ class PageHook implements \LanguageVisibilityPageRepositoryGetPageOverlayHookInt
public function getRecordOverlay_postProcess(
$table, &$row, &$sys_language_content, $OLmode, \LanguageVisibilityPageRepository $parent
) {
// Do nothing
if (!FrontendServices::isSupportedTable($table)) {
return;
}
if ($row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] > 0) {
$originalRow = BackendUtility::getRecord($table, $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]);
$element = FrontendServices::getElement($originalRow, $table);
try {
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($row['pid']);
} catch (SiteNotFoundException $e) {
// Somehow the element sits on a page that has no site configuration, we can not handle this
return;
}
$siteLanguage = $site->getLanguageById($sys_language_content);
if (!GeneralUtility::makeInstance(VisibilityService::class)->isVisible($siteLanguage, $element)) {
$row = NULL;
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment