Creating Hooks to an extension in TYPO3 6

1.1k views Asked by At

I'm trying to create a hook to news extension in TYPO3 6. The hook is created for an extension but not from an extension.

I created a directory called Hooks in typo3conf/ext/ directory. My hook is /typo3conf/ext/Hooks/tx_news_tceMain.php

class tx_news_tceMain{
function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, &$reference)
{
    if($table='tx_new_domain_model' && $status='new')
        mail('[email protected]','News added!','Body!');
}
}

I did not give any namespaces here.

So basicallly every time a news record is saved and viewed, a mail is sent.

I registered the hook in news/ext_localconf.php

$GLOBALS ['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'EXT:Hooks/class.tx_tt_news_tceMain.php:tx_tt_news_tceMain';

This is not working! Am I doing it right ? Is there a way I can debug this ?

1

There are 1 answers

1
pgampe On BEST ANSWER

Cannot just create an extension directory. You need to create at least an ext_emcomf. And install the extension in the extension manager.

Otherwise TYPO3 won't find the extension.