/**
  * 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;
 }
 /**
  * Migrates all content elements for the page with the given pageUid to the selected column positions
  *
  * @param array $formdata
  * @param int $pageUid
  * @return int Number of Content elements updated
  */
 public function migrateContentForPage($formdata, $pageUid)
 {
     $fieldMapping = $this->sharedHelper->getFieldMappingArray($formdata, 'tv_col_', 'be_col_');
     $tvContentArray = $this->sharedHelper->getTvContentArrayForPage($pageUid);
     $count = 0;
     $sorting = 0;
     foreach ($tvContentArray as $key => $contentUidString) {
         if (array_key_exists($key, $fieldMapping) && $contentUidString != '') {
             $contentUids = explode(',', $contentUidString);
             foreach ($contentUids as $contentUid) {
                 $contentElement = $this->sharedHelper->getContentElement($contentUid);
                 if ($contentElement['pid'] == $pageUid) {
                     $this->sharedHelper->updateContentElementColPos($contentUid, $fieldMapping[$key], $sorting);
                     $this->sharedHelper->fixContentElementLocalizationDiffSources($contentUid);
                 }
                 $sorting += 25;
                 $count++;
             }
         }
     }
     return $count;
 }