Matthias Mullie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/156118

Change subject: Allow hook subscribers to also overwrite link to title
......................................................................

Allow hook subscribers to also overwrite link to title

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
---
M RELEASE-NOTES-1.24
M docs/hooks.txt
M includes/specials/SpecialEditWatchlist.php
3 files changed, 9 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/18/156118/1

diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24
index cd4e668..09133f7 100644
--- a/RELEASE-NOTES-1.24
+++ b/RELEASE-NOTES-1.24
@@ -67,6 +67,8 @@
   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
diff --git a/docs/hooks.txt b/docs/hooks.txt
index d704eb5..106884b 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -2944,6 +2944,7 @@
 $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.
diff --git a/includes/specials/SpecialEditWatchlist.php 
b/includes/specials/SpecialEditWatchlist.php
index 76f2f4a..73438d9 100644
--- a/includes/specials/SpecialEditWatchlist.php
+++ b/includes/specials/SpecialEditWatchlist.php
@@ -620,11 +620,6 @@
        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 @@
 
                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 ) 
. ")";
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/156118
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I30b3bbb2c5ef131f069a5aabfad8b88bc2cf09df
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to