From cd40e5a6f6a3a2673fc58a9920196628a7d1522a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Buchmann?= Date: Mon, 2 Dec 2024 21:07:10 +0100 Subject: [PATCH] Respect hidden records in routing Removes the default restrictions "HiddenRestriction", "StartTimeRestriction" and "EndTimeRestriction". But keeps the "DeletedRestriction". Editors can now preview pages etc. with proper routing. Closes #27 --- Classes/ConfigurationModifier.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Classes/ConfigurationModifier.php b/Classes/ConfigurationModifier.php index 6685cad..304b5d7 100644 --- a/Classes/ConfigurationModifier.php +++ b/Classes/ConfigurationModifier.php @@ -4,6 +4,7 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; use TYPO3\CMS\Core\Utility\GeneralUtility; class ConfigurationModifier @@ -73,6 +74,7 @@ protected static function findDynamicPages(array $dynamicPagesConfiguration): ar protected static function findPagesWithPlugins(array $withPlugins): array { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content'); + $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class)); $contentElementRecords = $queryBuilder ->select('pid') ->from('tt_content') @@ -88,6 +90,7 @@ protected static function findPagesWithPlugins(array $withPlugins): array protected static function findPagesWithSwitchableControllerActions(array $withSwitchableControllerActions): array { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content'); + $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class)); $constraints = []; foreach ($withSwitchableControllerActions as $withSwitchableControllerAction) { $constraints[] = $queryBuilder->expr()->like('pi_flexform', $queryBuilder->createNamedParameter('%>' . htmlentities($withSwitchableControllerAction) . '<%', \PDO::PARAM_STR)); @@ -104,6 +107,7 @@ protected static function findPagesWithSwitchableControllerActions(array $withSw protected static function findPagesContainingModules(array $modules): array { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); + $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class)); $pageRecords = $queryBuilder ->select('uid') ->from('pages') @@ -119,6 +123,7 @@ protected static function findPagesWithDoktypes(array $doktypes): array { $doktypes = array_map('intval', $doktypes); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); + $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class)); $pageRecords = $queryBuilder ->select('uid') ->from('pages') @@ -136,6 +141,7 @@ protected static function findPagesWithDoktypes(array $doktypes): array protected static function findPagesWithCType(array $withCType): array { $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content'); + $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class)); $contentElementRecords = $queryBuilder ->select('pid') ->from('tt_content')