Skip to content

Commit

Permalink
[BUGFIX] Full page in ConditionMatcher from PageTsConfigFactory
Browse files Browse the repository at this point in the history
In order for PageTSConfig conditions to work properly on all
fields of the page, the full page record needs to be handed
over to the ConditionMatcher.

A similar bugfix was already done in #100764, but it only
included the Frontend context.

Resolves: #100921
Related: #100047
Related: #100764
Releases: main, 12.4
Change-Id: Id65d36ceba2a5c69e220e93fb64989fe6d582498
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/79240
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
nhovratov authored and lolli42 committed Jun 8, 2023
1 parent 65a4713 commit 06b46e2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions typo3/sysext/core/Classes/TypoScript/PageTsConfigFactory.php
Expand Up @@ -18,6 +18,7 @@
namespace TYPO3\CMS\Core\TypoScript;

use Psr\Container\ContainerInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\Frontend\PhpFrontend;
use TYPO3\CMS\Core\ExpressionLanguage\DeprecatingRequestWrapper;
use TYPO3\CMS\Core\Site\Entity\Site;
Expand Down Expand Up @@ -116,16 +117,20 @@ public function create(
$setupConditionConstantSubstitutionVisitor->setFlattenedConstants($siteSettingsFlat);
$includeTreeTraverserConditionVerdictAware->addVisitor($setupConditionConstantSubstitutionVisitor);
}
$lastPage = [];
$lastPageFullRecord = [];
$pageId = 0;
if (!empty($fullRootLine)) {
$lastPage = $fullRootLine[array_key_last($fullRootLine)];
$pageId = $lastPage['uid'];
$lastPageFullRecord = BackendUtility::getRecord('pages', $pageId) ?: [];
}
$conditionMatcherVariables = [
'fullRootLine' => $fullRootLine,
'site' => $site,
'page' => $lastPage,
// @todo We're using the full page row here to provide all necessary fields (e.g. "backend_layout"),
// which are currently not included in the rows, RootlineUtility provides by default. We might
// want to switch to $fullRootLine[array_key_last($fullRootLine)] as soon as it contains all fields.
'page' => $lastPageFullRecord,
'pageId' => $pageId,
// @deprecated since v12, will be removed in v13.
'request' => new DeprecatingRequestWrapper($GLOBALS['TYPO3_REQUEST'] ?? null),
Expand Down

0 comments on commit 06b46e2

Please sign in to comment.