svewap / flux_translationfix

0 stars 3 forks source link

tx_flux_column not getting updated, when moving Content from one tx_flux_column to the first position in another tx_flux_column #1

Open SvenDeKa opened 6 years ago

SvenDeKa commented 6 years ago

When moving a content Element in default language (while language: connected mode) from one tx_flux_column to the top position inside of another tx_flux_column of the same tx_flux_parent, the translation only gets the sorting updated but not the tx_flux_column and therefore stays in the same contentArea of its parent

SvenDeKa commented 6 years ago

Hi I think I just fixed this behaviour.

If you like i can Provide a path next week.

in the meantime here is what I did:

TceMain.php: ` public function processCmdmap_postProcess(&$command, $table, $id, &$relativeTo, &$reference, &$pasteUpdate, &$pasteDataMap) { parent::processCmdmap_postProcess($command, $table, $id, $relativeTo, $reference, $pasteUpdate,$pasteDataMap);

    if ($table === 'tt_content') {
        if ('localize' === $command) {

            $record = $this->resolveRecordForOperation($table, $id);

            $this->contentService->fixRelationInLocalization($id, $relativeTo, $record, $reference);
        }
        if ('move' === $command) {
            $record = $this->resolveRecordForOperation($table, $id);
            $this->contentService->fixFluxColumnInLocalization($id, $record, $reference);
        }

    }
}

`

ContentService.php: ` public function fixFluxColumnInLocalization($uid, &$sourceRecord, DataHandler $reference) { if (!empty($sourceRecord['l18n_parent'])) { $defaultRecordUid = $sourceRecord['l18n_parent']; } else { $defaultRecordUid = $uid; } $alternativeLanguageUids = $this->recordService->get('pages_language_overlay','sys_language_uid','pid='.$sourceRecord['pid'].' AND deleted=0'); foreach ($alternativeLanguageUids as $languageUid){

        $localizedRecord = BackendUtility::getRecordLocalization('tt_content', $defaultRecordUid, $languageUid);
        $localizedRecord[0]['tx_flux_column'] = $sourceRecord['tx_flux_column'];//$parentLocalizedRecord[0]['uid'];
        $this->updateRecordInDataMap($localizedRecord[0], null, $reference);
        $this->recordService->update('tt_content', $localizedRecord[0]);
    }
}

`