/** * Processes a single field of a moved record and follows references. * * @param DataHandler $dataHandler Calling DataHandler instance * @param int $resolvedPageId Resolved real destination page id * @param string $table Name of parent table * @param int $uid UID of the parent record * @param string $field Name of the field of the parent record * @param string $value Value of the field of the parent record * @param array $configuration TCA field configuration of the parent record * @return void */ protected function moveRecord_processFieldValue(DataHandler $dataHandler, $resolvedPageId, $table, $uid, $field, $value, array $configuration) { $inlineFieldType = $dataHandler->getInlineFieldType($configuration); $inlineProcessing = ($inlineFieldType === 'list' || $inlineFieldType === 'field') && BackendUtility::isTableMovePlaceholderAware($configuration['foreign_table']) && (!isset($configuration['behaviour']['disableMovingChildrenWithParent']) || !$configuration['behaviour']['disableMovingChildrenWithParent']); if ($inlineProcessing) { if ($table === 'pages') { // If the inline elements are related to a page record, // make sure they reside at that page and not at its parent $resolvedPageId = $uid; } $dbAnalysis = $this->createRelationHandlerInstance(); $dbAnalysis->start($value, $configuration['foreign_table'], '', $uid, $table, $configuration); // Moving records to a positive destination will insert each // record at the beginning, thus the order is reversed here: foreach ($dbAnalysis->itemArray as $item) { $versionedRecord = BackendUtility::getWorkspaceVersionOfRecord($dataHandler->BE_USER->workspace, $item['table'], $item['id'], 'uid,t3ver_state'); if (empty($versionedRecord) || VersionState::cast($versionedRecord['t3ver_state'])->indicatesPlaceholder()) { continue; } $dataHandler->moveRecord($item['table'], $item['id'], $resolvedPageId); } } }
/** * Processes fields of a record for the publishing/swapping process. * Basically this takes care of IRRE (type "inline") child references. * * @param string $tableName Table name * @param string $fieldName: Field name * @param array $configuration TCA field configuration * @param array $liveData: Live record data * @param array $versionData: Version record data * @param DataHandler $dataHandler Calling data-handler object * @return void */ protected function version_swap_processFields($tableName, $fieldName, array $configuration, array $liveData, array $versionData, DataHandler $dataHandler) { $inlineType = $dataHandler->getInlineFieldType($configuration); if ($inlineType !== 'field') { return; } $foreignTable = $configuration['foreign_table']; // Read relations that point to the current record (e.g. live record): $liveRelations = $this->createRelationHandlerInstance(); $liveRelations->setWorkspaceId(0); $liveRelations->start('', $foreignTable, '', $liveData['uid'], $tableName, $configuration); // Read relations that point to the record to be swapped with e.g. draft record): $versionRelations = $this->createRelationHandlerInstance(); $versionRelations->setUseLiveReferenceIds(false); $versionRelations->start('', $foreignTable, '', $versionData['uid'], $tableName, $configuration); // Update relations for both (workspace/versioning) sites: if (count($liveRelations->itemArray)) { $dataHandler->addRemapAction($tableName, $liveData['uid'], array($this, 'updateInlineForeignFieldSorting'), array($tableName, $liveData['uid'], $foreignTable, $liveRelations->tableArray[$foreignTable], $configuration, $dataHandler->BE_USER->workspace)); } if (count($versionRelations->itemArray)) { $dataHandler->addRemapAction($tableName, $liveData['uid'], array($this, 'updateInlineForeignFieldSorting'), array($tableName, $liveData['uid'], $foreignTable, $versionRelations->tableArray[$foreignTable], $configuration, 0)); } }