---
title: "Frontend TypoScript"
manual: "TYPO3 Explained"
version: "12.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:typo3-request-attribute-frontend-typoscript@12.4"
source: "ApiOverview/RequestLifeCycle/RequestAttributes/FrontendTyposcript.rst"
rendered: "2026-10-21T15:29:37+00:00"
---

> [!WARNING]
> **Attention**
>
> TYPO3 v12 has reached end-of-life as of April 30th 2026 and
> is no longer being maintained. Use the version switcher on the top
> left of this page to select documentation for a supported version of TYPO3.
>
> Need more time before upgrading?
> You can purchase Extended Long Term Support (ELTS) for TYPO3 v12 here:
> [TYPO3 ELTS](https://typo3.com/services/extended-support-elts).

# Frontend TypoScript {#typo3-request-attribute-frontend-typoscript}

<!-- TODO: no Markdown rendering for "versionadded" -->

This request attribute obsoletes the usage of
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->tmpl.

The `frontend.typoscript` frontend request attribute provides access to the
`\TYPO3\CMS\Core\TypoScript\FrontendTypoScript` object. It contains
the calculated TypoScript `settings` (formerly `constants`) and
sometimes `setup`, depending on page cache status.

When a content object or plugin (plugins are content objects as well) needs the
current TypoScript, it can retrieve it using this API:

```php
// Substitution of $GLOBALS['TSFE']->tmpl->setup
$fullTypoScript = $request->getAttribute('frontend.typoscript')
    ->getSetupArray();
```

## API {#api}

-   **class FrontendTypoScript**

    -   *Fully qualified name:* `\TYPO3\CMS\Core\TypoScript\FrontendTypoScript`

    This class contains the TypoScript set up by the PrepareTypoScriptFrontendRendering
    Frontend middleware. It can be accessed in content objects:

    $frontendTypoScript = $request->getAttribute('frontend.typoscript');

    -   **getFlatSettings()**

        This is *always* set up by the middleware: Current settings (aka "TypoScript constants")
        are needed for page cache identifier calculation.

        This is a "flattened" array of all settings, as example, consider these settings TypoScript:

        ```php
        mySettings {
            foo = fooValue
            bar = barValue
        }
        ```

        This will result in this array:

        ```php
        $flatSettings = [
            'mySettings.foo' => 'fooValue',
            'mySettings.bar' => 'barValue',
        ];
        ```

        *Returns:* `array`

    -   **hasSetup()**

        When a page is retrieved from cache and does not contain COA_INT or USER_INT objects,
        Frontend TypoScript setup is not calculated, so the AST and the array are not set.

        Calling getSetupTree() or getSetupArray() will then throw an exception.

        To avoid the exception, consumers can call hasSetup() beforehand.

        Note casual content objects do not need to do this, since setup TypoScript is always
        set up when content objects need to be calculated.

        *Returns:* `bool`

    -   **getSetupArray()**

        The full Frontend TypoScript array.

        This is always set up as soon as the Frontend rendering needs to actually render something and
        can not get the full content from page cache. This is the case when a page cache entry does
        not exist, or when the page contains COA_INT or USER_INT objects.

        *Returns:* `array`
