Data Processors
Common behaviour
`appendData` — the menu, language-menu, gallery and files
processors share a destructive default: with append absent or
0 the processor removes data from the processed result and
strips data from every item in the target (as) array — for menus
recursively through all children. Set append to keep the
raw record data.
`as` defaults — when as is omitted, each processor falls back
to its default target name:
| Processor | Default as |
|---|---|
| MenuProcessor | menu |
| LanguageMenuProcessor | languagemenu |
| GalleryProcessor | gallery |
| FilesProcessor | media |
| DatabaseQueryProcessor | records |
| RootSitesProcessor | sites |
DatabaseQueryProcessor
It's the EXT: equivalent of TYPO3's own DatabaseQueryProcessor.
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 data)
it provides the following properties:
fields— JSON-style field map applied to every rowoverride— same, merged over already-processed rowsFields return(Default: 0) — return the single row directly instead of an arrayFlatten Object
fields and override are rendered through the
JSON cObject, so every per-field option
documented there (intval, if, nested fields,
data, …) works inside them.
ExtractPropertyProcessor
Extract a single (maybe nested) property from a given array.
Both as and key are required — the processor throws an
exception when either is missing. Its result replaces the entire
processed data: only [as => value] survives, everything else the
previous processors produced is discarded.
Example see below in section on FilesProcessor.
FilesProcessor
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
}
}
Sources besides references.: references (list of
sys_ uids, optionally references.), files
(sys_ uids), collections (file collection uids), folders
(combined-identifier folder paths, folders. to descend).
Further options: sorting (file property, sorting.),
append (1 keeps the processed record data alongside the files;
absent or 0 — the default — strips data from the result, see
Common behaviour) and the processing block described
in Image rendering. Default as is media.
FlexFormProcessor
This DataProcessor allows to process a flexform field such as tt_
and optionally override its property values.
field defaults to pi_. When as is omitted, the
processed flexform is written back in place — into
data.<field, or the top-level <field key when the value
lives there.
10 = FriendsOfTYPO3\Headless\DataProcessing\FlexFormProcessor
10 {
fieldName = pi_flexform
as = flexform
overrideFields {
fieldA = TEXT
fieldA {
value = 123
}
}
}
GalleryProcessor
See Images GalleryProcessor.
Supports append (see Common behaviour); default as is
gallery.
RootSitesProcessor
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 =
}