diff --git a/Classes/Utility/ConfigUtility.php b/Classes/Utility/ConfigUtility.php index 0f96e5c..fc5f7e1 100644 --- a/Classes/Utility/ConfigUtility.php +++ b/Classes/Utility/ConfigUtility.php @@ -14,19 +14,36 @@ class ConfigUtility { public static function getRootPageConfig(): array { + $request = self::getRequest(); + /** @var \TYPO3\CMS\Core\Site\Entity\Site $site */ - $site = self::getRequest()->getAttribute('site'); + $site = $request->getAttribute('site'); $rootPageId = $site->getRootPageId(); + /** @var \TYPO3\CMS\Core\Site\Entity\SiteLanguage $siteLanguage */ + $siteLanguage = $request->getAttribute('language'); + $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class); $queryBuilder = $connectionPool->getQueryBuilderForTable('pages'); $flexFormStr = $queryBuilder ->select('tx_headless_config') ->from('pages') ->where( - $queryBuilder->expr()->eq( - 'uid', - $queryBuilder->createNamedParameter($rootPageId, Connection::PARAM_INT) + $queryBuilder->expr()->and( + $queryBuilder->expr()->or( + $queryBuilder->expr()->eq( + 'uid', + $queryBuilder->createNamedParameter($rootPageId, Connection::PARAM_INT) + ), + $queryBuilder->expr()->eq( + 'l10n_parent', + $queryBuilder->createNamedParameter($rootPageId, Connection::PARAM_INT) + ), + ), + $queryBuilder->expr()->eq( + 'sys_language_uid', + $queryBuilder->createNamedParameter($siteLanguage->getLanguageId(), Connection::PARAM_INT) + ), ) ) ->executeQuery() diff --git a/Configuration/TCA/Overrides/pages.php b/Configuration/TCA/Overrides/pages.php index 675fbe3..302a220 100644 --- a/Configuration/TCA/Overrides/pages.php +++ b/Configuration/TCA/Overrides/pages.php @@ -26,6 +26,9 @@ 'label' => 'LLL:EXT:rmnd_headless/Resources/Private/Language/locallang_pages.xlf:page_config', 'config' => [ 'type' => 'flex', + 'behaviour' => [ + 'allowLanguageSynchronization' => true, + ], 'ds' => [ 'default' => 'FILE:EXT:rmnd_headless/Configuration/FlexForms/Empty.xml', ],