page-content data processor

New in version 13.2

This data processor \TYPO3\CMS\Frontend\DataProcessing\PageContentFetchingProcessor , alias page-content, loads all tt_content records from the current backend layout into the template with a given identifier for each colPos, also respecting slideMode or collect options based on the page layouts content columns.

An array of Record objects will be passed to the Fluid template. You can use the CObject ViewHelper <f:cObject> to display the content elements.

Options

Name Type Default
string "content"
if condition ''

as

as
Type
string
Required
false
Default
"content"

Name for the variable in the Fluid template.

if

if
Type
if condition
Required
false
Default
''

Only if the condition is met the data processor is executed.

Example: Use the page-content data processor to display the content

config/sites/my-site/setup.typoscript
page = PAGE
page {
    10 = PAGEVIEW
    10 {
        paths.10 = EXT:my_sitepackage/Resources/Private/Templates/
        dataProcessing.10 = page-content
        dataProcessing.10.as = myContent
    }
}
Copied!

Use the identifiers of the columns in the Fluid template:

EXT:my_sitepackage/Resources/Private/Templates/Pages/Default.html
<main>
    <f:for each="{myContent.jumbotron.records}" as="contentElement">
        <f:if condition="{contentElement.fullType} = 'tt_content.my_extension_jumbotron'">
            <h2>{contentElement.header}</h2>
            <f:format.html>{contentElement.bodytext}</f:format.html>
        </f:if>
    </f:for>
    <f:for each="{myContent.left.records}" as="contentElement">
        <f:cObject
            typoscriptObjectPath="{contentElement.mainType}"
            table="{contentElement.mainType}"
            data="{contentElement}"
        />
    </f:for>
</main>
<aside>
    <f:for each="{myContent.right.records}" as="contentElement">
        <f:if condition="{contentElement.fullType} = 'tt_content.header'">
            <h2>{contentElement.header}</h2>
        </f:if>
    </f:for>
</aside>
Copied!

You can use the CObject ViewHelper <f:cObject> to render the content element using typo3/cms-fluid-styled-content or render it your self.

{contentElement.mainType}
Is always "tt_content" for content elements.
{contentElement.fullType}
Is composed of "tt_content.[CType]". For a content element of type text it contains "tt_content.text".

The backend layout is defined like this:

config/sites/my-site/page.tsconfig
mod.web_layout.BackendLayouts {
    default {
        title = Default
        config {
            backend_layout {
                colCount = 2
                rowCount = 2
                rows {
                    1 {
                        columns {
                            1 {
                                name = Jumbotron
                                colPos = 1
                                identifier = jumbotron
                                slideMode = slide
                                colspan = 2
                            }
                        }
                    }

                    2 {
                        columns {
                            1 {
                                name = Left
                                colPos = 0
                                identifier = left
                            }

                            2 {
                                name = Right
                                colPos = 2
                                identifier = right
                                slideMode = collectReverse
                            }
                        }
                    }
                }
            }
        }
    }
}
Copied!

Modify the result via AfterContentHasBeenFetchedEvent

New in version 13.4.2 | 14.0

The event AfterContentHasBeenFetchedEvent can be used to modify the content elements fetched by the page-content data processor.

See the following example: Filter content elements provided by the page-content data processor.