Add WhatLinksHereProps hook, to allow extensions to annotate WhatLinksHere entries.
authorAndrew Garrett <agarrett@wikimedia.org>
Thu, 27 Feb 2014 06:27:42 +0000 (17:27 +1100)
committerErik Bernhardson <ebernhardson@wikimedia.org>
Thu, 1 May 2014 04:23:35 +0000 (21:23 -0700)
Needed by change 110090

Change-Id: I679abfbbdbd56498ec87579b4fe4e49ad486c84c

RELEASE-NOTES-1.24
docs/hooks.txt
includes/specials/SpecialWhatlinkshere.php

index fd422fa..c0bb285 100644 (file)
@@ -11,6 +11,8 @@ production.
 === Configuration changes in 1.24 ===
 
 === New features in 1.24 ===
+* Added a new hook, "WhatLinksHereProps", to allow extensions to annotate
+  WhatLinksHere entries.
 
 === Bug fixes in 1.24 ===
 * (bug 62258) A bug was fixed in File::getUnscaledThumb when a height
index 80f388b..688e0cd 100644 (file)
@@ -2922,6 +2922,12 @@ Return false to prevent setting of the cookie.
 &$expire: Cookie expiration, as for PHP's setcookie()
 $options: Options passed to WebResponse::setcookie()
 
+'WhatLinksHereProps': Allows annotations to be added to WhatLinksHere
+$row: The DB row of the entry.
+$title: The Title of the page where the link comes FROM
+$target: The Title of the page where the link goes TO
+&$props: Array of HTML strings to display after the title.
+
 'WikiExporter::dumpStableQuery': Get the SELECT query for "stable" revisions
 dumps. One, and only one hook should set this, and return false.
 &$tables: Database tables to use in the SELECT query
index 0587649..6488810 100644 (file)
@@ -265,11 +265,11 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                        $nt = Title::makeTitle( $row->page_namespace, $row->page_title );
 
                        if ( $row->rd_from && $level < 2 ) {
-                               $out->addHTML( $this->listItem( $row, $nt, true ) );
+                               $out->addHTML( $this->listItem( $row, $nt, $target, true ) );
                                $this->showIndirectLinks( $level + 1, $nt, $wgMaxRedirectLinksRetrieved );
                                $out->addHTML( Xml::closeElement( 'li' ) );
                        } else {
-                               $out->addHTML( $this->listItem( $row, $nt ) );
+                               $out->addHTML( $this->listItem( $row, $nt, $target ) );
                        }
                }
 
@@ -286,7 +286,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                return Xml::openElement( 'ul', ( $level ? array() : array( 'id' => 'mw-whatlinkshere-list' ) ) );
        }
 
-       protected function listItem( $row, $nt, $notClose = false ) {
+       protected function listItem( $row, $nt, $target, $notClose = false ) {
                $dirmark = $this->getLanguage()->getDirMark();
 
                # local message cache
@@ -326,6 +326,8 @@ class SpecialWhatLinksHere extends IncludableSpecialPage {
                        $props[] = $msgcache['isimage'];
                }
 
+               wfRunHooks( 'WhatLinksHereProps', array( $row, $nt, $target, &$props ) );
+
                if ( count( $props ) ) {
                        $propsText = $this->msg( 'parentheses' )
                                ->rawParams( implode( $msgcache['semicolon-separator'], $props ) )->escaped();