Allow hook subscribers to also overwrite link to title
authorMatthias Mullie <git@mullie.eu>
Mon, 25 Aug 2014 14:42:43 +0000 (16:42 +0200)
committerMatthias Mullie <git@mullie.eu>
Mon, 25 Aug 2014 14:42:43 +0000 (16:42 +0200)
Flow, for example, has those totally illegible Titles like
Topic:S0gx52fzru1680ib - instead, we'd rather use the topic
title content as link text.

Change-Id: I30b3bbb2c5ef131f069a5aabfad8b88bc2cf09df

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

index cd4e668..09133f7 100644 (file)
@@ -67,6 +67,8 @@ production.
   instead.
 
 === New features in 1.24 ===
+* Added new argument &$link in hook WatchlistEditorBuildRemoveLine, allowing the
+  link to the title to be changed.
 * Added a new hook, "WhatLinksHereProps", to allow extensions to annotate
   WhatLinksHere entries.
 * Added a new hook, "ContentGetParserOutput", to customize parser output for
index d704eb5..106884b 100644 (file)
@@ -2944,6 +2944,7 @@ Special:Watchlist/edit.
 $title: Title object
 $redirect: whether the page is a redirect
 $skin: Skin object
+&$link: HTML link to title
 
 'WebRequestPathInfoRouter': While building the PathRouter to parse the
 REQUEST_URI.
index 76f2f4a..73438d9 100644 (file)
@@ -620,11 +620,6 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
        private function buildRemoveLine( $title ) {
                $link = Linker::link( $title );
 
-               if ( $title->isRedirect() ) {
-                       // Linker already makes class mw-redirect, so this is redundant
-                       $link = '<span class="watchlistredir">' . $link . '</span>';
-               }
-
                $tools[] = Linker::link( $title->getTalkPage(), $this->msg( 'talkpagelinktext' )->escaped() );
 
                if ( $title->exists() ) {
@@ -645,9 +640,14 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
 
                wfRunHooks(
                        'WatchlistEditorBuildRemoveLine',
-                       array( &$tools, $title, $title->isRedirect(), $this->getSkin() )
+                       array( &$tools, $title, $title->isRedirect(), $this->getSkin(), &$link )
                );
 
+               if ( $title->isRedirect() ) {
+                       // Linker already makes class mw-redirect, so this is redundant
+                       $link = '<span class="watchlistredir">' . $link . '</span>';
+               }
+
                return $link . " (" . $this->getLanguage()->pipeList( $tools ) . ")";
        }