public postProcessRecord ( string $operation, integer $id, array &$row, TYPO3\CMS\Core\DataHandling\DataHandler $reference, array $removals = [] ) : void | ||
$operation | string | TYPO3 operation identifier, i.e. "update", "new" etc. |
$id | integer | The ID of the current record (which is sometimes now included in $row |
$row | array | the record data, by reference. Changing fields' values changes the record's values just before saving |
$reference | TYPO3\CMS\Core\DataHandling\DataHandler | A reference to the \TYPO3\CMS\Core\DataHandling\DataHandler object that is currently saving the record |
$removals | array | Allows overridden methods to pass an additional array of field names to remove from the stored Flux value |
return | void |
public function postProcessRecord($operation, $id, array &$row, DataHandler $reference, array $removals = array())
{
if ('update' === $operation) {
$record = $reference->datamap[$this->tableName][$id];
$stored = $this->recordService->getSingle($this->tableName, '*', $record['uid']);
$fieldName = $this->getFieldName((array) $record);
$dontProcess = NULL === $fieldName || FALSE === isset($row[$fieldName]) || FALSE === isset($record[$fieldName]['data']) || FALSE === is_array($record[$fieldName]['data']);
if (TRUE === $dontProcess) {
return;
}
$data = $record[$fieldName]['data'];
foreach ($data as $sheetName => $sheetFields) {
foreach ($sheetFields['lDEF'] as $sheetFieldName => $fieldDefinition) {
if ('_clear' === substr($sheetFieldName, -6)) {
array_push($removals, $sheetFieldName);
} else {
$clearFieldName = $sheetFieldName . '_clear';
$clearFieldValue = (bool) (TRUE === isset($data[$sheetName]['lDEF'][$clearFieldName]['vDEF']) ? $data[$sheetName]['lDEF'][$clearFieldName]['vDEF'] : 0);
$shouldClearField = 0 < $data[$sheetName]['lDEF'][$clearFieldName]['vDEF'];
if (TRUE === $shouldClearField || TRUE === $clearFieldValue) {
array_push($removals, $sheetFieldName);
}
}
}
}
$stored[$fieldName] = MiscellaneousUtility::cleanFlexFormXml($row[$fieldName], $removals);
$row[$fieldName] = $stored[$fieldName];
$reference->datamap[$this->tableName][$id][$fieldName] = $row[$fieldName];
$this->recordService->update($this->tableName, $stored);
}
}
/** * @param string $operation * @param integer $id * @param array $row * @param DataHandler $reference * @param array $removals Allows overridden methods to pass an additional array of field names to remove from the stored Flux value * @return void */ public function postProcessRecord($operation, $id, array &$row, DataHandler $reference, array $removals = array()) { if (TRUE === self::shouldCallWithClassName(__CLASS__, __FUNCTION__, $id)) { parent::postProcessRecord($operation, $id, $row, $reference, $removals); $parameters = GeneralUtility::_GET(); $this->contentService->affectRecordByRequestParameters($id, $row, $parameters, $reference); self::trackMethodCallWithClassName(__CLASS__, __FUNCTION__, $id); } }