Not deprecated way to get Title object of the current page

Jump to: navigation, search

Hello everyone! What is the right way to get the Title object of the current page when I write an extesnion? I have used $wgTitle and $wgArticle for that but now they both are going to be deprecated. There is no information of alternatives neither on Manual:$wgArticle nor on Manual:$wgTitle.

The way I found seem like wrong and horrible workaround:

Title::newFromText($wgRequest->getText('title'))
Katkov Yury12:07, 17 October 2011

You should not need to use that to get a Title object, but rather get from an object you get in your hook or parser function: Parser, OutputPage, Skin and other have a Title object that you can get by calling their getTitle() method. There is however no replacement for $wgArticle; if you need one you will need to create it, but some parts from the Article class are now also available in Title.

iAlex13:34, 17 October 2011

Oh, that's clear now, thanks! I'll figure out the details and added the description to the Manual:$wgArticle and Manual:$wgTitle pages.

Katkov Yury10:12, 18 October 2011
 
 
Personal tools

Variants
Actions
Navigation
Support
Download
Development
Communication
Toolbox