[TYPO3-project-seminars] Using the hooks

Niels Pardon typo3_lists at niels-pardon.de
Wed Aug 12 15:37:33 CEST 2009


Christian Lerrahn (Cerebrum) schrieb:
> Hi Niels,
>>> I'm trying to use the hooks in seminars but so far with little
>>> success. I've already found out that the naming scheme is somewhat
>>> unorthodox and my method is being called.
>>>
>>> The problem I have now, is that the only parameter that is passed is
>>> the seminars class object which seems unusable because most of its
>>> properties are private. Using one of the class' methods results in a
>>> PHP error.
>>>
>>> However, at the same time it seems that there is no return value
>>> expected from the hooks.
>>>
>>> Did I just get it wrong is there a bug somewhere?
>> Well, the attributes and methods are kept private by intention. We
>> only want to offer a limited API so we are able to change the other
>> stuff without further notice.
> 
> Let me get that right. The hooks are useless but they have to be
> because otherwise you would have to keep an API over time. What are
> they there for then? I'm not sure I get it. :(

No, that's not quite right. We offer a limited API. You can use all the
publicly available methods. Everything else may change at a later time.

>> The hook doesn't expect a return value as the hook expects that you
>> are using the templating methods available in the seminars object.
> 
> Ok. But that's what I can;t do because of the structure of the object,
> right?

Take a closer look at the code. Place a marker ###MY_CUSTOM_MARKER###
into your template file and set it's content within the hook using
setMarker('MY_CUSTOM_MARKER', $content).

function modifySingleView(tx_seminars_pi1 $parent) {
	$content = 'I\'m your custom marker content.';
	$parent->setMarker('my_custom_marker', $content);
}

Greets,

Niels


More information about the TYPO3-project-seminars mailing list