TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Frontend\DataProcessing\CommaSeparatedValueProcessor Class Reference
Inheritance diagram for TYPO3\CMS\Frontend\DataProcessing\CommaSeparatedValueProcessor:
TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface

Public Member Functions

 process (ContentObjectRenderer $cObj, array $contentObjectConfiguration, array $processorConfiguration, array $processedData)
 

Detailed Description

This data processor will take field data formatted as a string, where each line, separated by line feed, represents a row. By default columns are separated by the delimiter character "comma ,", and can be enclosed by the character 'quotation mark "', like the default in a regular CSV file.

An example of such a field is "bodytext" in the CType "table".

The table data is transformed to a multi dimensional array, taking the delimiter and enclosure into account, before it is passed to the view.

Example field data:

This is row 1 column 1|This is row 1 column 2|This is row 1 column 3 This is row 2 column 1|This is row 2 column 2|This is row 2 column 3 This is row 3 column 1|This is row 3 column 2|This is row 3 column 3

Example TypoScript configuration:

10 = TYPO3 10 { if.isTrue.field = bodytext fieldName = bodytext fieldDelimiter = | fieldEnclosure = maximumColumns = 2 as = table }

whereas "table" can be used as a variable {table} inside Fluid for iteration.

Using maximumColumns limits the amount of columns in the multi dimensional array. In the example, field data of the last column will be stripped off.

Multi line cells are taken into account.

Definition at line 56 of file CommaSeparatedValueProcessor.php.

Member Function Documentation

◆ process()

TYPO3\CMS\Frontend\DataProcessing\CommaSeparatedValueProcessor::process ( ContentObjectRenderer  $cObj,
array  $contentObjectConfiguration,
array  $processorConfiguration,
array  $processedData 
)

Process CSV field data to split into a multi dimensional array

Parameters
ContentObjectRenderer$cObjThe data of the content element or page
array$contentObjectConfigurationThe configuration of Content Object
array$processorConfigurationThe configuration of this processor
array$processedDataKey/value store of processed data (e.g. to be passed to a Fluid View)
Returns
array the processed data as key/value store

Implements TYPO3\CMS\Frontend\ContentObject\DataProcessorInterface.

Definition at line 67 of file CommaSeparatedValueProcessor.php.

References TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\checkIf(), TYPO3\CMS\Core\Utility\CsvUtility\csvToArray(), and TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\stdWrapValue().