[TYPO3-dev] Using Hooks in own classes

Ingo Schmitt mailinglisten at i-schmitt.de
Sat Feb 11 20:09:43 CET 2006


Hi list,

when implementiong hooks in own classes, there are some ways to define 
these hooks:

1) Define one hook array per Method in each class
2) Define one hook array per whole class and use different hook-methods 
in each Method

1 only initialises a hook object if realy used, so if a method is not 
called, the hookObject isn't initialised. If you use more than one hook, 
  more Hook Objects are created.

2 initiallises all hook objects for the class at creation of the class 
object

(I think in general the internal costs of creation of the hook objects 
are in both cases almost the same)

The Core uses Method 2, method 1 could be more elegant in the way of 
coding it.


Which way should I use?


Mit freundlichen Gruessen
-- 
Ingo Schmitt                        mailto:is at marketing-factory.de
Marketing Factory Consulting GmbH   http://typo3.marketing-factory.de/
Content Management mit Typo3: Beratung - Schulung - Realisierung




More information about the TYPO3-dev mailing list