Hooks Definitions are confusing to me

Fragment of a discussion from Project:Support desk
Jump to: navigation, search

The function sample now matches what it should be (a public static function, with the same name as the value added to the $wgHooks registry).

Krinkle (talk)01:25, 1 May 2012

Thanks for the fix! I also tried that but did not really step through how all these templates relate to each other. :-)

88.130.110.21917:18, 1 May 2012
 

I encountered this yesterday on another hook page and was quite confused by what the sample code was indicating: http://www.mediawiki.org/wiki/Manual:Hooks/ImageBeforeProduceHTML

It looks like all your hooks examples are done this way.

209.29.183.17219:38, 1 May 2012

You mean the class name, which is present in the line "$wgHooks['ParserFirstCallInit'][] = ...", but not present in the function definition? Right, it should be at both places, or at none. Having it at both would blow up all the function definitions, so I have just taken it out.

88.130.110.21922:21, 1 May 2012
 

Reverted, please discuss further at Template talk:MediaWikiHook.

Krinkle (talk)04:23, 3 May 2012