Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
TYPO3 Extension Development

You're reading from   TYPO3 Extension Development

Arrow left icon
Product type Paperback
Published in Sep 2008
Publisher
ISBN-13 9781847192127
Length 232 pages
Edition Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Dmitry Dulepov Dmitry Dulepov
Author Profile Icon Dmitry Dulepov
Dmitry Dulepov
Arrow right icon
View More author details
Toc

Implementing a Frontend Hook


The Frontend hook class file goes into the extension's directory. The file is named class.tx_feuserstat_hooks.php. According to coding conventions, the class name becomes tx_feuserstat_hooks. There will be only one hook inside but we name the file (and the class) in plural to enable adding more hooks if necessary in future versions.

When adding this class, GPL and XCLASS declarations should be added manually. Make sure you do this first thing after creating a new class for TYPO3.

Now, we create a dummy function for the hook. The function name has to be checkDataSubmission because it is hard-coded like this in the TSFE.

The TSFE provides a reference to itself as a parameter to the hook function. The same reference is available as $GLOBALS['TSFE']. For better clarity, we will use the global variable and will skip the function parameter completely.

Next, we need to register the hook. We do it by adding the following code to ext_localconf.php:

$GLOBALS['TYPO3_CONF_VARS...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image