php - How to use Hook "processDatamap_postProcFieldArray" in TYPO3 6.x -


use case: when saving object (in backend, maybe in frontend later) want manipulate values before saving database.

problem: file seems included (shows error on save if choose wrong file path) function not seem executed on save of object.

there many how-tos (most of them t4.5 related) , related questions on stackoverflow none of them seems work me.

environement: typo3 6.2, extbase

minimalistic test case:

/ext/navolspmanager/ext_localconf.php

$globals['typo3_conf_vars']['sc_options']['t3lib/class.t3lib_tcemain.php']['processdatamapclass'][] = 'ext:navolspmanager/classes/hooks/getgeocodeshook.php:\nachvorne\navolspmanager\hooks\getgeocodeshook';  

upadted reference: last line had changed solve problem

/ext/navolspmanager/classes/hooks/getgeocodeshook.php

<?php     namespace nachvorne\navolspmanager\hooks;     class getgeocodeshook {         public function processdatamap_preprocessfieldarray( array $fieldarray, $table, $id, \typo3\cms\core\datahandling\datahandler &$pobj ) {             if ($table == 'tx_navolspmanager_domain_model_dataset') {                 $fieldarray['geolng'] = 01.001; // testing purposes                 var_dump($fieldarray); die();             }             else{                 var_dump($table); die();             }         }     } 

current status: on save doesn't crash or show anything, smoothly saves , ignores function.

can show me missing here?

solved:

in ext_localconf.php there '/' missing inside namespace ...

$globals['typo3_conf_vars']['sc_options']['t3lib/class.t3lib_tcemain.php']['processdatamapclass'][] =           'ext:navolspmanager/classes/hooks/getgeocodeshook.php:\nachvorne\navolspmanager\hooks\getgeocodeshook'; 

improvements:

when updating 1 field according other user input should use 'processdatamap_postprocessfieldarray' function. way trim, date , number stuff etc done @ moment grep input.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -