[TYPO3-dev] Hooks and protected class members

Jigal van Hemert jigal at xs4all.nl
Wed Sep 22 22:05:27 CEST 2010


Hi,

Thank you for your response! Nice to have extra brain power :-)

On 22-9-2010 19:21, Christian Opitz - Netzelf wrote:
> Am 22.09.2010 15:04, schrieb Jigal van Hemert:
>> We could try to set up such a construction where the class which
>> provides the hook somehow (with the help of t3lib_div::makeInstance()
>> perhaps) adds the class with the hook function to it's list of
>> friends. This way the hook functions can access protected members
>> through the __get and __set.
>>
>> Opinions?
> Maybe a more generic way would be to enforce that a hook-class has to be
> part of the class-"package" - means the first part of it's name must be
> the name of the hook-provider-class. I've posted an example here:
> http://pastebin.com/DDwrbVaH

Interesting variation. It needs some more tweaking to take into account 
XCLASS versions of classes.

It still feels easier if the makeInstance function helps to register the 
hook class as a "friend".

I'm also not sure if there is a backwards compatible way, so extensions 
can provide such a mechanism and still work with older versions of TYPO3.

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh




More information about the TYPO3-dev mailing list