twolefthands twolefthands -3 years ago 88
PHP Question

How do I make a successfull callback for a mediawiki extension hook?

I have the following code in my extension.hooks.php file:

public static function onEditFormPreloadText( &$text, &$title )
return true;
}


the 'return true;' should tell Mediawiki to continue regularly with generating the create page, but I am getting the following error that I simply can't wrap my head around.

[59f7b43514fbe1ec0988f3b0] /mediawiki/index.php?title=newwikipage&action=edit&redlink=1
MWException from line 176 of
...\mediawiki\htdocs\includes\Hooks.php:
Invalid callback AutoLinkerHooks::onEditFormPreloadText in hooks for EditFormPreloadText

Backtrace:
#0 ...\mediawiki\htdocs\includes\EditPage.php(628): Hooks::run(string, array)
#1 ...\mediawiki\htdocs\includes\actions\EditAction.php(59): EditPage->edit()
#2 ...\mediawiki\htdocs\includes\MediaWiki.php(495): EditAction->show()
#3 ...\mediawiki\htdocs\includes\MediaWiki.php(289): MediaWiki->performAction(Article, Title)
#4 ...\mediawiki\htdocs\includes\MediaWiki.php(851): MediaWiki->performRequest()
#5 ...\mediawiki\htdocs\includes\MediaWiki.php(512): MediaWiki->main()
#6 ...\mediawiki\htdocs\index.php(43): MediaWiki->run()
#7 {main}


I have no idea where the function goes wrong since I've read the documention about 5 times right now, but perhaps I'm just missing something.

Mediawiki-documentation that I used: Manual:Developing_extensions | Manual:Hooks

Answer Source

It turns out I had a spelling error within my extension.json files. . . .

 "AutoloadClasses": {
"AutoLinkrHooks": "AutoLinker.hooks.php"
},

Oops.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download