---
title: "process-variables"
manual: "Handlebars"
version: "main"
permalink: "https://docs.typo3.org/permalink/cpsit/typo3-handlebars:data-processor-process-variables@main"
source: "Usage/DataProcessors/ProcessVariables.rst"
rendered: "2026-09-29T09:05:57+00:00"
---

# process-variables {#data-processor-process-variables}

**Class:** `\CPSIT\Typo3Handlebars\DataProcessing\ProcessVariablesProcessor`

Processes a `variables` configuration block — exactly like the
top-level `variables` of `HANDLEBARSTEMPLATE` — within
a data processor chain. This is most useful when combined with other processors
such as `database-query`, allowing per-record variable processing.

-   [Data sources](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:data-sources@main)
-   [Choosing which record to process](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:choosing-which-record-to-process@main)
-   [Standalone usage](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:standalone-usage@main)
-   [Nested inside another processor](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:nested-inside-another-processor@main)
-   [Properties](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:properties@main)

## Data sources {#data-processor-process-variables-data-sources}

All options are read from this processor's own configuration block.
`table` additionally falls back to a same-named key in
`processedData`, and finally to the table of the current content
object.

The `preProcessing` and `postProcessing` hooks
have access to all data sources (see
[DataSourceAwareProcessor](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:developer-corner-data-source-aware-processor@main)).

## Choosing which record to process {#data-processor-process-variables-payload}

By default, the `field` option of a `variables`
entry resolves against the current content element's own record. Configure
`dataSource` (or an inline `data` array) to process
a different record or array instead — see [Referencing data](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:usage-data-sources-payload@main)
for how it is resolved, and [Using the current value](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:usage-data-sources-current@main) for
`dataSource.current`. If the resolved payload is not an array,
it is ignored and the current record's own field values are used instead.

## Standalone usage {#data-processor-process-variables-standalone}

```typoscript
tt_content.my_element = HANDLEBARSTEMPLATE
tt_content.my_element {
    templateName = MyElement

    dataProcessing {
        10 = process-variables
        10 {
            variables {
                header = TEXT
                header.field = header

                teaser = TEXT
                teaser.field = bodytext
                teaser.parseFunc =< lib.parseFunc_RTE
            }
        }
    }
}
```

## Nested inside another processor {#data-processor-process-variables-nested}

```typoscript
dataProcessing {
    10 = database-query
    10 {
        table = tx_myext_domain_model_item
        as = items

        dataProcessing {
            10 = process-variables
            10 {
                as = item
                variables {
                    title = TEXT
                    title.field = title

                    body = TEXT
                    body.field = bodytext
                    body.parseFunc =< lib.parseFunc_RTE
                }
            }
        }
    }
}
```

## Properties {#data-processor-process-variables-properties}

-   **`variables`**

    Variables to process. Same syntax as the top-level
    `variables` in `HANDLEBARSTEMPLATE`.

-   **`table`**

    Database table of the record to use as the data source for field
    lookups. Defaults to the current table in content object renderer.

-   **`data`**

    Inline data used as the field-lookup source for `variables`,
    if `dataSource` is not configured (see
    [Choosing which record to process](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:data-processor-process-variables-payload@main)).

-   **`dataSource`**

    Data source(s) to use as the field-lookup source for
    `variables`, instead of the current record (see
    [Choosing which record to process](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:data-processor-process-variables-payload@main)).

-   **`as`**

    Target key in the processed data array. When set, the processed
    variables are stored under this key. When omitted, the processed
    variables replace (or merge into) the root of the processed data.

-   **`merge`**

    Boolean. When `1` and `as` is omitted,
    the processed variables are merged into the existing processed data
    rather than replacing it. When `as` is set and the key
    already holds an array, the processed variables are merged into that
    array. Default: `0`.

-   **`if`**

    Standard TypoScript `if` condition. When the condition
    evaluates to false, the processor is skipped and the processed data
    is returned unchanged.

-   **`preProcessing`**

    [Data source aware processors](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:developer-corner-data-source-aware-processor@main)
    run before `variables` are processed.

-   **`postProcessing`**

    [Data source aware processors](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:developer-corner-data-source-aware-processor@main)
    run after `variables` are processed.
