"Tbleher" posted a comment on MediaWiki.r111168.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/111168#c30776

Commit summary for MediaWiki.r111168:

GOOD BYE $wgArticle!
It was stated that it would be removed in 1.20 and we are in 1.20.

Tbleher's comment:

Hmm, so how does one access article related information now?

I have the following simple code, and couldn't see how to port it to MW 1.20, 
despite searching for quite a while:
<source lang="php">
$wgHooks['SkinTemplateNavigation'][] = 'wfAlterEditPageLinkHook2';
function wfAlterEditPageLinkHook2( &$vector, &$links ) {
        global $wgTitle, $wgArticle;
        if( array_key_exists( 'edit', $links['views'] ) && 
$wgTitle->isContentPage() && $wgArticle !== null && $wgArticle->isCurrent() ){
                if( $wgTitle->exists() ) {
                        $links['views']['edit']['href'] = Title::newFromText( 
'Spezial:Spiel_bearbeiten/'. $wgTitle->getPrefixedDBkey() )->getLocalUrl();
                } else {
                        $links['views']['edit']['href'] = Title::newFromText( 
'Spezial:Neues_Spiel/'. $wgTitle->getPrefixedDBkey() )->getLocalUrl();
                }
        }
        return true;
}
</source>
(the code redirects the edit link to a special page, but only if the page 
viewed is the current version of the article).

Could you document how to do something like this when using MW 1.20? The best 
place to document this would probably be [[Manual:$wgArticle]].

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to