Reputation: 73
I'm trying to develop a MediaWiki tag extension and have read through the Manual:Tag Extension page as well as tried quering the internet. I have my hook:
$wgParser->setHook( 'notext', 'tkNTNoTextTag' ); //Function called when see tag
and it's called function:
function tkNTNoTextTag($input, $argv, $parser, $frame) {
$output = $parser->recursiveTagParse($input, $frame);
return $output.$myText;
}
These work as expected/described. What I don't know how to do is get a page's text or content when a function is called. The MediaWiki Manual:Tag Extension pages shows which arguments are passed in when the hook is seen. I'd like to know what I have to do to be able to get the content of a page when the hook is called, either through the page's title or directly. I want to not just grab the text inside the tag, $input is the text inside, but rather the entire page when the tag is seen and I do not want to wrap the entire page in a custom tag, that seems ridiculous. Does anyone know how to do this or what resource I can read?
I'm very green when it comes to PHP and MediaWiki extensions.
Upvotes: 1
Views: 271
Reputation: 738
Look into the other Hooks available. Manual:Hooks If you use something like the
ArticleAfterFetchContent
hook, it has the article object and the text of the article passed in
public static function onArticleAfterFetchContent( &$article, &$content ) { ... }
You can call this hook to return the content or other article information.
tkNTNoTextTag()
Upvotes: 1