Search code examples
typo3typoscript

Accessing root page id in typoscript (TYPO3)


I would like to get the root page id for a DatabaseQueryProcessor in the setup.typescript. I think I should do it by the SiteProcessor, but I have not understood the processors yet.

So I have no idea why that is not working:

41 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
41 {
    table = tt_content
    pidInList = TYPO3\CMS\Frontend\DataProcessing\SiteProcessor.rootPageId
    where = colPos = 2
    as = default-header-image
    dataProcessing {
    10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
    10 {
        references.fieldName = image
    }
  }
}

Maybe important to note. The snippet is located in the dataProcessing part of the FLUIDTEMPLATE that is located on a page ("page.FLUIDTEMPLATE.dataProcessing.41").

Do you have any hints or solutions for me?

Thank you for your time :-)


Solution

  • pidInList expects a list of page IDs or can be processed with stdWrap: https://docs.typo3.org/m/typo3/reference-typoscript/11.5/en-us/Functions/Select.html#pidinlist

    stdWrap itself provides the data function. Which itself provides access to the site configuration: https://docs.typo3.org/m/typo3/reference-typoscript/11.5/en-us/Functions/Data.html#site

    So something like that should work:

    41.pidInList.data = site:rootPageId