---
title: "Data Processors"
manual: "Headless"
version: "4.9"
permalink: "https://docs.typo3.org/permalink/friendsoftypo3/headless:dataprocessors@4.9"
source: "Developer/DataProcessors.rst"
rendered: "2026-11-30T17:42:51+00:00"
---

# Data Processors {#dataprocessors}

## CategoriesProcessor {#dataprocessors-categoriesprocessor}

Returns categories as a list of objects instead of a comma-separated
string, e.g. to add categories to pages or content elements of the
trimmed response. Identifier: `headless-categories`.

```typoscript
lib.contentElement.fields.categories = JSON
lib.contentElement.fields.categories {
  dataProcessing {
    10 = headless-categories
    10 {
      relation.fieldName = categories
      as = categories
    }
  }
}
```

```json
"categories": [
  {"id": 2, "title": "Category 2"},
  {"id": 1, "title": "Category 1"}
]
```

Properties:

-   `relation.fieldName` — category field of the current record
-   `relation.table` (Default: current table) — table of the current record
-   `uidInList` — comma-separated list of category uids, used if no
    relation is configured; the categories are returned in the given order
-   `pidInList` (Default: `root`, which means pid 0) and `recursive`
    (Default: 0) — storage of the categories
-   `fields` (Default: `uid,title`) — `sys_category` fields to return,
    `uid` is returned as `id`
-   `orderBy` (Default: sorting of the relation or order of `uidInList`) —
    only field names with an optional `ASC` or `DESC` are allowed
-   `as` (Default: `categories`)

## DatabaseQueryProcessor {#dataprocessors-databasequeryprocessor}

It's the `EXT:headless` equivalent of TYPO3's own DatabaseQueryProcessor.

```typoscript
10 = FriendsOfTYPO3\Headless\DataProcessing\DatabaseQueryProcessor
10 {
  table = tt_content
  pidInList = 123
  as = contents
  fields {
    header = TEXT
    header {
      field = header
    }
    bodytext = TEXT
    bodytext {
      field = bodytext
      parseFunc =< lib.parseFunc_RTE
    }
  }
}
```

Apart from the properties of TYPO3's DatabaseQueryProcessor (`if`, `table`, `as` and `dataProcessing`)
it provides the following properties:

-   `fields`
-   `overrideFields`
-   `returnFlattenObject` (Default: 0)
-   `returnFlattenLegacy` (Default: 1)

## ExtractPropertyProcessor {#dataprocessors-extractpropertyprocessor}

Extract a single (maybe nested) property from a given array.

Example see below in section on FilesProcessor.

## FilesProcessor {#dataprocessors-filesprocessor}

```typoscript
lib.meta.fields.ogImage = TEXT
lib.meta.fields.ogImage {
  dataProcessing {
    # Use the column 'og_image' to render an array with all relevant
    # information (such as the publicUrl)
    10 = FriendsOfTYPO3\Headless\DataProcessing\FilesProcessor
    10.as = media
    10.references.fieldName = og_image
    10.processingConfiguration.returnFlattenObject = 1

    # Extract only property 'publicUrl' from the above created array
    20 = FriendsOfTYPO3\Headless\DataProcessing\ExtractPropertyProcessor
    20.key = media.publicUrl
    20.as = media
  }
}
```

## FlexFormProcessor {#dataprocessors-flexformprocessor}

This DataProcessor allows to process a flexform field such as `tt_content.pi_flexform`
and optionally override its property values.

```typoscript
10 = FriendsOfTYPO3\Headless\DataProcessing\FlexFormProcessor
10 {
  fieldName = pi_flexform
  as = flexform
  overrideFields {
    fieldA = TEXT
    fieldA {
      value = 123
    }
  }
}
```

## GalleryProcessor {#dataprocessors-galleryprocessor}

See [Images GalleryProcessor](https://docs.typo3.org/permalink/friendsoftypo3/headless:images-galleryprocessor@4.9)

## MenuProcessor {#dataprocessors-menuprocessor}

It's the `EXT:headless` equivalent of TYPO3's MenuProcessor.

Have a look at `lib.breadcrumbs` for example:

```typoscript
lib.breadcrumbs = JSON
lib.breadcrumbs {
  dataProcessing {
    10 = FriendsOfTYPO3\Headless\DataProcessing\MenuProcessor
    10 {
      special = rootline
      expandAll = 0
      includeSpacer = 1
      titleField = nav_title // title
      as = breadcrumbs
    }
  }
}
```

## RootSiteProcessor {#dataprocessors-rootsiteprocessor}

```typoscript
10 = FriendsOfTYPO3\Headless\DataProcessing\RootSitesProcessor
10 {
   as = sites
   # allow to override provider of data for output processor, if empty defaults to FriendsOfTYPO3\Headless\DataProcessing\RootSiteProcessing\SiteProvider
   # your-class implementing FriendsOfTYPO3\Headless\DataProcessing\RootSiteProcessing\SiteProviderInterface
   # example value: Vendor\Project\RootSiteProcessing\CustomSiteProvider
   siteProvider =
   # allow to override output of processor, if empty defaults to FriendsOfTYPO3\Headless\DataProcessing\RootSiteProcessing\SiteSchema
   # your-class implementing FriendsOfTYPO3\Headless\DataProcessing\RootSiteProcessing\SiteSchemaInterface
   # example value: Vendor\Project\RootSiteProcessing\CustomSiteSchema
   siteSchema =
   # provider configuration, if empty defaults to 'sorting' field from pages table
   # example value = custom_sorting
   sortingField =
   # if empty defaults to sort by "sorting" field from `pages` table
   # your-class implementing FriendsOfTYPO3\Headless\DataProcessing\RootSiteProcessing\SiteSortingInterface
   # example value: Vendor\Project\RootSiteProcessing\CustomSorting
   sortingImplementation =
   # list of uid of root pages should be returned, i.e. you have 5 root pages(1,2,3,4,5), but two (4,5) of not ready to display, so you can hide it
   # example value = 1,2,3
   allowedSites =
   # automatically fetch root sites from another page/separator and filter sites yaml configs by returned list from database
   # very useful when you have multi site setup in one instance.
   # example value = 1
   sitesFromPid =
   # if empty defaults to uid,title,sorting - list of columns to fetch from database and provided for SiteSchema/DomainSchema to use
   # example value = uid,title,sorting
   dbColumns =
   # if empty defaults to "title" field from pages table, get site name from database
   # example value = your-custom-field-from-pages-table
   titleField =
}
```
