[TYPO3-dev] tcemain + processDatamap_preProcessFieldArray

Christian Tauscher christian.tauscher at media-distillery.de
Sun Dec 27 01:06:50 CET 2009


Hello TYPO3-World!

I'd like to count my Record-copys.

In List -Module everything is as usual. Copy-Paste, you know that.

Now I have writte a nice Module wich is close to the list-Module, but
displays my records in a more comfortable way.

With

$params = '&cmd[table]['.$this->row['uid'].'][copy]=-'.$this->row['uid'];
$out .= '<a href="#" onclick="'.htmlspecialchars('return
jumpToUrl(\''.$SOBE->doc->issueCommand($params).'\');').'
...

I have added a Copy button to my List, this works really fine.

But....

I need toincrement a certain field.
I have tried this with hooks in tcemain/processDatamap, but all the
hooks are call-by-value.

> $hookObj->processDatamap_preProcessFieldArray($incomingFieldArray,
$table, $id, $this);

How to save my Data back?

I need a call-by-reference:

> $hookObj->processDatamap_preProcessFieldArray(&$incomingFieldArray,
$table, $id, $this);

How can I change Data before it is written to DB?

Best solution so far is this:

(Hook-Class):
function processDatamap_afterDatabaseOperations($status, $table, $id,
&$fieldArray, &$reference) {
$fields_values['week'] = $fieldArray['week']+1;
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_tmdcinema_program','uid =
'.$id,$fields_values);
}
}


This works, but how can I Limit this hook only to be called inside *my*
module? List-Module should not be touched.
Same should be If a realy New (not a copy) record is created, the hook
should not be called.



I've gambled round with TCE/Command Arrays (DOC: TYPO3coreAPI), but I
did not get it to work.


I hove everybody is clear what I am trying, and someone can help me.

Happy New Year!

Christian.






More information about the TYPO3-dev mailing list