[Typo3-dev] Question regarding hooks in t3lib_tcemain process_datamap

christian reiter cr at n-o-s-p-a-m-cxd.de
Fri Nov 26 14:13:36 CET 2004


Hello,

I am a bit confused by two different ways hooks are handled in
process_datamap() in the class.t3lib_tcemain.php

Once, there is around line 587

        if (method_exists($hookObj, 'processDatamap_postProcessFieldArray'))
{
         $hookObj->processDatamap_postProcessFieldArray($status, $table,
$id, $fieldArray, $this);
        }

which is logical; if i have registered my hook and have a method with this
name, precisely that method  is used.

However around line 480 there is

       if (method_exists($hookObj,
'processDatamap_preProcessIncomingFieldArray')) {
        $hookObj->processDatamap_preProcessFieldArray($incomingFieldArray,
$table, $id, $this);
    }

Here it is checked whether the method
'processDatamap_preProcessINCOMINGFieldArray' exists, and if yes, then a
*different* method than the one checked for, is used:
processDatamap_preProcessFieldArray without the "Incoming".

This means that if i define the method of the name that is checked for, the
script dies for sake of a missing method to call; if I define only the
second one it is never called due to failed detection. So it seems I have to
define two methods, one essentially empty one called
processDatamap_preProcessINCOMINGFieldArray to enable the detection and one
with the other name to be executed. At least when I do this the hook is
actually executed when the page is saved.

Is this separation between detection name and execution name intended? I
find it confusing.

Thanks for any help,

Christian Reiter






More information about the TYPO3-dev mailing list