Issue Bug Under Review

#106180Building the local rootline fails to detect root systemplate if page has multiple template records

Jigal van Hemert 02/14/25, 18:48 updated 11/09/26, 20:12

Description

Situation:
For historical reasons there is a central “page” which is the parent of all web site roots in the installation.

"TYPO3 root" <- contains root sys_template record
 +- "Site 1" <- contains root sys_template record
 |  +- page 1
 +- "Site 2" <- contains root sys_template record

If “Site 1” contains a sys_template record with the “root” property set and one or more sys_template records without the “root” property set, building the local rootline may fail to detect the “root” property.
First an array is created with the “pid” as key and the sys_template as value. With multiple sys_template records in a page the second (and third) record will overwrite the first one. If only the first one has the “root” option set the page will not be recognized as root page.

One effect is that HMENU will not use that page as the root of the menu.

This happens in v12 in \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::getFromCache(), in v13 in \TYPO3\CMS\Frontend\Page\PageInformationFactory::setLocalRootLine() (haven’t checked v14 yet)

The solution is to build $sysTemplateRowsIndexedByPid with an array of systemplateRows and loop through them to check $sysTemplateRowsIndexedByPid[$pageId]['root'] for each of the sys template rows.

Note: the pagetree structure is a bit non-standard but has been working since v 4.x. The multiple sys_template records per page are in this situation caused by virtual TS templates which are added by a AfterTemplatesHaveBeenDeterminedEvent listener

Reviews 1

History 15