public function pasteAfter($command, array &$row, $parameters, DataHandler $tceMain)
{
$id = $row['uid'];
$tablename = 'tt_content';
$subCommand = NULL;
$possibleArea = NULL;
$parentUid = NULL;
$relativeRecord = NULL;
$possibleColPos = NULL;
$nestedArguments = explode('-', $parameters[1]);
$numberOfNestedArguments = count($nestedArguments);
if (5 < $numberOfNestedArguments) {
// Parameters were passed in a hyphen-glued string, created by Flux and passed into command.
list($pid, $subCommand, $relativeUid, $parentUid, $possibleArea, $possibleColPos) = $nestedArguments;
$parentUid = (int) $parentUid;
// Parent into same grid results in endless loop
if ('move' === $command && (int) $id === $parentUid && (int) $pid === (int) $row['pid']) {
return;
}
$relativeUid = 0 - (int) $relativeUid;
if (FALSE === empty($possibleArea)) {
// Flux content area detected, override colPos to virtual Flux column number.
// The $possibleColPos variable may or may not already be set but must be
// overridden regardless.
$possibleColPos = self::COLPOS_FLUXCONTENT;
}
} elseif (5 === $numberOfNestedArguments) {
// Parameters are directly from TYPO3 and it almost certainly is a paste to page column.
list(, $possibleColPos, , $relativeUid) = $nestedArguments;
// $relativeUid parameter is not passed by every context. If not set and $pid is negative,
// we must assume that the positive value of $pid is our relative target UID.
$relativeUid = (int) (0 >= (int) $pid) ? $pid : $relativeUid;
} elseif (2 === count($parameters) && is_numeric($parameters[1])) {
// The most basic form of pasting: using the clickmenu to "paste after" sends only
// two parameters and the second parameter is always numeric-only.
list($tablename, $relativeUid) = $parameters;
}
// Creating the copy mapping array. Initial processing of all records being pasted,
// either simply assigning them (copy action) or adjusting the copies to become
// "insert records" elements which then render the original record (paste reference).
$mappingArray = $this->createMappingArray($command, $subCommand, $id, $row, $tceMain);
// If copying is performed relative to another element we must assume the values of
// that element and use them as target relation values regardless of earlier parameters.
if (0 > $relativeUid) {
$relativeRecord = $this->loadRecordFromDatabase(abs($relativeUid));
$possibleColPos = (int) $relativeRecord['colPos'];
$possibleArea = $relativeRecord['tx_flux_column'];
$parentUid = (int) $relativeRecord['tx_flux_parent'];
}
$this->applyMappingArray($mappingArray, $pid, $possibleColPos, $possibleArea, $parentUid, $tablename, $relativeUid, $relativeRecord, $tceMain);
}