简体   繁体   中英

Creating Hooks to an extension in TYPO3 6

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@me.com','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 ?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM