Issue Bug Closed

#103573Using site configuration in TCA not working for new page

Philipp Gollmer 04/09/24, 06:44 updated 10/15/24, 09:31

Description

“###SITE:mySetting.categoryPid###” does not work when you are in the form to create a new page.
The TCA for pages has therefore been extended and exactly this configuration has been implemented.

https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/SiteHandling/UseSiteInTCA.html

// ...
'fieldConfiguration' => [
    'foreign_table_where' => ' AND ({#sys_category}.uid = ###SITE:rootPageId### OR {#sys_category}.pid = ###SITE:mySetting.categoryPid###) ORDER BY sys_category.title ASC',
],
// ...

As no site object exists at this point, it is from the “NullSite” object. This is why the parsing in AbstractitemProvider->parseSiteConfiguration() exits at this point and produces an error, because it doesn’t parse the statement. Since no site exists, the site configuration cannot be read.

Therefore this behavior only exists when a new page is created. An existing page works perfectly.

Same behavior exists in V12 and V11.

Reviews 4