Christian Tauscher
2017-08-08 11:11:17 UTC
Hello dear Developers
I am about porting an Extention from T3-6.2 to T3-7.6+
in the original EXT I have used a Hook in case a record is copied the
increase some value:
function processDatamap_preProcessFieldArray(
&$fieldArray, $table, $id, &$reference
) {
// make sure only my table in handeled
if($table != "tx_myext_table") return;
// t3_origuid is set? Yes, ist a Copy
if(isset($fieldArray['t3_origuid'])) {
$fieldArray['field1']++;
$fieldArray['filed2']--;
}
}
I translated this to this 7.6 Hook-Call
public function processDatamap_preProcessFieldArray(
&$fieldArray, $table, $id,
\TYPO3\CMS\Core\DataHandling\DataHandler &$pObj
) {
// do the same stuff as in 6.2
// BUT...
}
BUT: How can I tell exactly this record is a COPY?
the field 't3_origuid' seems not to be existing anymore.
one try:
if(strpos(key($pObj->datamap['tx_myext_table']), 'NEW') === 0) {
// do the stuff to be done
}
But this seems not to work and a really NEW record would be catched, too....
If you know a hook to use for this case in T3 7.6+ please let me know.
Christian.
I am about porting an Extention from T3-6.2 to T3-7.6+
in the original EXT I have used a Hook in case a record is copied the
increase some value:
function processDatamap_preProcessFieldArray(
&$fieldArray, $table, $id, &$reference
) {
// make sure only my table in handeled
if($table != "tx_myext_table") return;
// t3_origuid is set? Yes, ist a Copy
if(isset($fieldArray['t3_origuid'])) {
$fieldArray['field1']++;
$fieldArray['filed2']--;
}
}
I translated this to this 7.6 Hook-Call
public function processDatamap_preProcessFieldArray(
&$fieldArray, $table, $id,
\TYPO3\CMS\Core\DataHandling\DataHandler &$pObj
) {
// do the same stuff as in 6.2
// BUT...
}
BUT: How can I tell exactly this record is a COPY?
the field 't3_origuid' seems not to be existing anymore.
one try:
if(strpos(key($pObj->datamap['tx_myext_table']), 'NEW') === 0) {
// do the stuff to be done
}
But this seems not to work and a really NEW record would be catched, too....
If you know a hook to use for this case in T3 7.6+ please let me know.
Christian.