Skip to content

Commit

Permalink
fix: creation of comments on contents
Browse files Browse the repository at this point in the history
  • Loading branch information
tgaertner committed Nov 13, 2024
1 parent f998350 commit 34d76b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Classes/Hooks/DataHandlerHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ public function processDatamap_beforeStart(DataHandler $dataHandler): void
if (array_key_first($datamap) === 'tx_ximatypo3contentplanner_comment') {
$id = array_key_first($datamap['tx_ximatypo3contentplanner_comment']);
if (!MathUtility::canBeInterpretedAsInteger($id) && !array_key_exists('pages', $dataHandler->datamap)) {
$dataHandler->datamap['pages'][$datamap['tx_ximatypo3contentplanner_comment'][$id]['pid']]['tx_ximatypo3contentplanner_comments'] = $id;
$table = $datamap['tx_ximatypo3contentplanner_comment'][$id]['foreign_table'];
if($table === 'pages') {jj
$dataHandler->datamap['pages'][$datamap['tx_ximatypo3contentplanner_comment'][$id]['pid']]['tx_ximatypo3contentplanner_comments'] = $id;
}
if($table === 'tt_content') {
$dataHandler->datamap['tt_content'][$datamap['tx_ximatypo3contentplanner_comment'][$id]['foreign_uid']]['tx_ximatypo3contentplanner_comments'] = $id;
}
// Set author to current user
$dataHandler->datamap['tx_ximatypo3contentplanner_comment'][$id]['author'] = $GLOBALS['BE_USER']->getUserId();
}
Expand Down

0 comments on commit 34d76b7

Please sign in to comment.