[TYPO3] Building a hook

Bernhard Kraft kraftb at kraftb.at
Fri Mar 10 16:48:55 CET 2006


tapio wrote:
> Bernhard Kraft wrote:
> 
>> tapio wrote:
>>
>>>                                                     $_procObj =
>>> &t3lib_div::getUserObj($hasAccessControl);
>>
>>
>>
>> And this just returns you an object. You also have to call a method out
>> of it with:
>>
>> $hasAccess = $_procObj->method();
> 
> 
> But I can't know that method someone else might use.
> I thought that the method comes from
> foreach ($TYPO3_CONF_VARS['EXTCONF']['tm_contentaccess']['hasAccess'] as
> $hasAccessControl)

Look at the hooks in t3lib_tcemain ... they always do something like:

$_procObj->postProcessData(...)

The method which get's called is part of the API of the hook ... the same as you have to set some
specific array variable to a class (TYPO3_CONF_VARS[EXTCONF]...) you have to have specific named
methods in the hook-class.

> 
>> Else you would get "no access" when no hook is installed.

Sorry wrong:

> if(is_array($TYPO3_CONF_VARS['EXTCONF']['tm_contentaccess']['hasAccess']))
>    {
>                                                 foreach
> ($TYPO3_CONF_VARS['EXTCONF']['tm_contentaccess']['hasAccess'] as
> $hasAccessControl) {
>                                                      $_procObj =
> &t3lib_div::getUserObj($hasAccessControl);

you will get no access if the variable T3_conf_vars[extconf][...] was set but not to a valid
class/object ... simply because the if is_array() will succeed but the ::getUserObj will return
an invalid object ....

don't you get that you check if the object exists ... you never call any code of your hook-class ... how
shall something get done/determined ????


greets,
Bernhard
-- 
----------------------------------------------------------------------
"Freiheit ist immer auch die Freiheit des Andersdenkenden"
Rosa Luxemburg, 1871 - 1919
----------------------------------------------------------------------



More information about the TYPO3-english mailing list