Hooks: processDatamap_preProcessFieldArray()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Hooks: processDatamap_preProcessFieldArray()

Christian Tauscher-4
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.
_______________________________________________
TYPO3-english mailing list
[hidden email]
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Hooks: processDatamap_preProcessFieldArray()

Christian Tauscher-4
Am 08.08.2017 um 13:11 schrieb Christian Tauscher:

>     // t3_origuid is set? Yes, ist a Copy
>    if(isset($fieldArray['t3_origuid'])) {
>       $fieldArray['field1']++;
>       $fieldArray['filed2']--;
>    }

Ages ago I did use the workspace feature t3_origuid, this is set by the
core if its there and explains if-statement.

sofar this works again, but :

> If you know a better hook to use for this case in T3 7.6+ please let
> me know.


Christian.
_______________________________________________
TYPO3-english mailing list
[hidden email]
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
Loading...