FluidTYPO3\Flux\Service\ContentService::fixPositionInLocalization PHP 메소드

fixPositionInLocalization() 공개 메소드

public fixPositionInLocalization ( integer $uid, integer $languageUid, array &$defaultLanguageRecord, TYPO3\CMS\Core\DataHandling\DataHandler $reference )
$uid integer uid of record in default language
$languageUid integer sys_language_uid of language for the localized record
$defaultLanguageRecord array record in default language (from table tt_content)
$reference TYPO3\CMS\Core\DataHandling\DataHandler
    public function fixPositionInLocalization($uid, $languageUid, &$defaultLanguageRecord, DataHandler $reference)
    {
        $previousLocalizedRecordUid = $this->getPreviousLocalizedRecordUid($uid, $languageUid, $reference);
        $localizedRecord = BackendUtility::getRecordLocalization('tt_content', $uid, $languageUid);
        if (NULL === $previousLocalizedRecordUid) {
            // moving to first position in tx_flux_column
            $localizedRecord[0][$sortingRow] = $reference->getSortNumber('tt_content', 0, $defaultLanguageRecord['pid']);
        } else {
            $sortingRow = $GLOBALS['TCA']['tt_content']['ctrl']['sortby'];
            $localizedRecord[0][$sortingRow] = $reference->resorting('tt_content', $defaultLanguageRecord['pid'], $sortingRow, $previousLocalizedRecordUid);
        }
        $this->updateRecordInDatabase($localizedRecord[0]);
    }

Usage Example

예제 #1
0
 /**
  * Post-process a command executed on a record form the table this ConfigurationProvider
  * is attached to.
  *
  * @param string $command
  * @param integer $id
  * @param array $row
  * @param integer $relativeTo
  * @param DataHandler $reference
  * @return void
  */
 public function postProcessCommand($command, $id, array &$row, &$relativeTo, DataHandler $reference)
 {
     if (TRUE === self::shouldCallWithClassName(__CLASS__, __FUNCTION__, $id)) {
         parent::postProcessCommand($command, $id, $row, $relativeTo, $reference);
         $pasteCommands = array('copy', 'move');
         if (TRUE === in_array($command, $pasteCommands)) {
             $callback = $this->getCallbackCommand();
             if (TRUE === isset($callback['paste'])) {
                 $pasteCommand = $callback['paste'];
                 $parameters = explode('|', $pasteCommand);
                 $this->contentService->pasteAfter($command, $row, $parameters, $reference);
             } else {
                 $moveData = (array) $this->getMoveData();
                 $this->contentService->moveRecord($row, $relativeTo, $moveData, $reference);
             }
         }
         if ('localize' === $command) {
             $this->contentService->fixPositionInLocalization($id, $relativeTo, $row, $reference);
         }
         self::trackMethodCallWithClassName(__CLASS__, __FUNCTION__, $id);
     }
 }