Skip to content

Commit 6acd25e

Browse files
committed
[BUGFIX] Ensure same record is added to maxItems count on copy command
1 parent c3c28d0 commit 6acd25e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Classes/Hooks/CmdmapDataHandlerHook.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use IchHabRecht\ContentDefender\BackendLayout\BackendLayoutConfiguration;
2121
use TYPO3\CMS\Backend\Utility\BackendUtility;
2222
use TYPO3\CMS\Core\DataHandling\DataHandler;
23+
use TYPO3\CMS\Core\Utility\StringUtility;
2324

2425
class CmdmapDataHandlerHook extends AbstractDataHandlerHook
2526
{
@@ -42,7 +43,10 @@ public function processCmdmap_beforeStart(DataHandler $dataHandler)
4243

4344
$currentRecord = BackendUtility::getRecord('tt_content', $id);
4445

45-
if ($command === 'move') {
46+
if ($command === 'copy') {
47+
// Enforce a new uid when copying a record to ensure correct maxItems validation
48+
$currentRecord['uid'] .= StringUtility::getUniqueId('-NEW');
49+
} else {
4650
// New colPos is passed as datamap array and already processed in processDatamap_beforeStart
4751
$data = isset($dataHandler->datamap['tt_content'][$id])
4852
? $dataHandler->datamap : ($_POST['data'] ?? $_GET['data'] ?? null);

0 commit comments

Comments
 (0)