/** * Migrates all content elements for the FCE with the given uid to the selected column positions * * @param array $contentElement * @param array $formdata * @return int Number of Content elements updated */ public function migrateContentElementsForFce($contentElement, $formdata) { $fieldMapping = $this->sharedHelper->getFieldMappingArray($formdata, 'tv_col_', 'ge_col_'); $tvContentArray = $this->sharedHelper->getTvContentArrayForContent($contentElement['uid']); $translationParentUid = (int) $contentElement['l18n_parent']; $sysLanguageUid = (int) $contentElement['sys_language_uid']; $pageUid = (int) $contentElement['pid']; $count = 0; $sorting = 0; foreach ($tvContentArray as $key => $contentUidString) { if (array_key_exists($key, $fieldMapping) && $contentUidString != '') { $contentUids = explode(',', $contentUidString); foreach ($contentUids as $contentUid) { $contentUid = (int) $contentUid; $myContentElement = NULL; $myContentElement = $this->sharedHelper->getContentElement($contentUid); $containerUid = (int) $contentElement['uid']; if ($translationParentUid > 0 && $sysLanguageUid > 0) { $myCeTranslationParentUid = (int) $myContentElement['uid']; if ($myCeTranslationParentUid > 0) { $tmpMyContentElement = $this->sharedHelper->getTranslationForContentElementAndLanguage($myCeTranslationParentUid, $sysLanguageUid); $tmpMyContentUid = (int) $tmpMyContentElement['uid']; if ($tmpMyContentUid > 0) { $contentUid = $tmpMyContentUid; $myContentElement = $tmpMyContentElement; } else { $containerUid = $translationParentUid; } } else { $containerUid = $translationParentUid; } } else { $myContentElement = $this->sharedHelper->getContentElement($contentUid); } if (intval($myContentElement['pid']) === $pageUid) { $this->sharedHelper->updateContentElementForGe($contentUid, $containerUid, $fieldMapping[$key], $sorting); } $sorting += 25; $count++; $this->sharedHelper->fixContentElementLocalizationDiffSources($contentUid); $this->refIndex->updateRefIndexTable('tt_content', $contentUid); } } } return $count; }