RecordTransformationProcessor

New in version 13.2

A new TypoScript data processor for FLUIDTEMPLATE and PAGEVIEW has been added.

The record-transformation Data Processor can typically be used in conjunction with the DatabaseQuery Data Processor. The DatabaseQuery Data Processor typically fetches records from the database, and the record-transformation will take the result, and transforms the objects into Record objects, which contain only relevant data from the TCA table, which has been configured in the TCA columns fields for this record.

This is especially useful for TCA tables, which contain "types" (such as pages or tt_content database tables), where only relevant fields are added to the record object. In addition, special fields from "enableColumns" or deleted fields, next to language and version information are extracted so they can be addressed in a unified way.

The type property contains the database table name and the actual type based on the record, such tt_content.textmedia for Content Elements.

Example: Usage with the DatabaseQueryProcessor

Example usage for the Data Processor in conjunction with the DatabaseQueryProcessor.

EXT:my_extension/Configuration/TypoScript/setup.typoscript
page = PAGE
page {
  10 = PAGEVIEW
  10 {
    paths.10 = EXT:my_extension/Resources/Private/Templates/
    dataProcessing {
      10 = database-query
      10 {
        as = categories
        table = sys_category
        select.where = parent=0
        dataProcessing.10 = record-transformation
      }
    }
  }
}
Copied!

Example: Usage with FLUIDTEMPLATE

Transform the current data array of FLUIDTEMPLATE to a record object. This can be used for Content Elements of Fluid Styled Content or custom ones. In this example the Fluid Styled Content element "Text" has its data transformed for easier and enhanced usage.

EXT:my_extension/Configuration/TypoScript/setup.typoscript
# tt_content.text = FLUIDTEMPLATE
tt_content.text {
  templateName = Text
  dataProcessing {
    10 = record-transformation
    10 {
      as = data
    }
  }
}
Copied!

Usage in Fluid

The f:debug output of the Record object is misleading for integrators, as most properties are accessed differently as one would assume. The debug view is most of all a better organized overview of all available information. E.g. the property properties lists all relevant fields for the current Content Type.

We are dealing with an object here, which behaves like an array. In short: you can access your record properties as you are used to with {record.title} or {record.uid}. In addition, you gain special, context-aware properties like the language {record.languageId} or workspace {data.versionInfo.workspaceId}.

Overview of all possibilities:

Demonstration of available variables in Fluid
<!-- Any property, which is available in the Record (like normal) -->
{record.title}
{record.uid}
{record.pid}

<!-- Language related properties -->
{record.languageId}
{record.languageInfo.translationParent}
{record.languageInfo.translationSource}

<!-- The overlaid uid -->
{record.overlaidUid}

<!-- Types are a combination of the table name and the Content Type name. -->
<!-- Example for table "tt_content" and CType "textpic": -->

<!-- "tt_content" (this is basically the table name) -->
{record.mainType}

<!-- "textpic" (this is the CType) -->
{record.recordType}

<!-- "tt_content.textpic" (Combination of mainType and record type, separated by a dot) -->
{record.fullType}

<!-- System related properties -->
{data.systemProperties.isDeleted}
{data.systemProperties.isDisabled}
{data.systemProperties.isLockedForEditing}
{data.systemProperties.createdAt}
{data.systemProperties.lastUpdatedAt}
{data.systemProperties.publishAt}
{data.systemProperties.publishUntil}
{data.systemProperties.userGroupRestriction}
{data.systemProperties.sorting}
{data.systemProperties.description}

<!-- Computed properties depending on the request context -->
{data.computedProperties.versionedUid}
{data.computedProperties.localizedUid}
{data.computedProperties.requestedOverlayLanguageId}
{data.computedProperties.translationSource} <!-- Only for pages, contains the Page model -->

<!-- Workspace related properties -->
{data.versionInfo.workspaceId}
{data.versionInfo.liveId}
{data.versionInfo.state.name}
{data.versionInfo.state.value}
{data.versionInfo.stageId}
Copied!

Options:

as
Type
string / stdWrap
Default
'record' or 'records'

The target variable containing the resolved record objects. If empty, 'record' or 'records' (if multiple records are given) is used.

if
Type
if condition
Default
''

Only if the condition is met the Data Processor is executed.

table
Type
string
Default
auto-resolved

The name of the database table of the records. Leave empty to auto-resolve the table from context.

If you are dealing with a custom data source you can adjust it here.

variableName
Type
string
Default
'data'

The variable that contains the record(s) from a previous Data Processor, or from a FLUIDTEMPLATE view.

If you are dealing with a custom data source you can adjust it here.