From 567f127179e7f77c17d96a6154788651b8970b60 Mon Sep 17 00:00:00 2001 From: Florianschmidtwelzow Date: Mon, 27 Apr 2015 07:34:15 +0200 Subject: [PATCH] Add edit link to each row on Special:WhatLinksHere Bug: T97269 Change-Id: Ic13b775bc0c0ede947086c7eb305ac5d4f2fcd12 --- includes/specials/SpecialWhatlinkshere.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index be77e62746..69a8074609 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -314,7 +314,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { static $msgcache = null; if ( $msgcache === null ) { static $msgs = array( 'isredirect', 'istemplate', 'semicolon-separator', - 'whatlinkshere-links', 'isimage' ); + 'whatlinkshere-links', 'isimage', 'edit' ); $msgcache = array(); foreach ( $msgs as $msg ) { $msgcache[$msg] = $this->msg( $msg )->escaped(); @@ -355,7 +355,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { } # Space for utilities links, with a what-links-here link provided - $wlhLink = $this->wlhLink( $nt, $msgcache['whatlinkshere-links'] ); + $wlhLink = $this->wlhLink( $nt, $msgcache['whatlinkshere-links'], $msgcache['edit'] ); $wlh = Xml::wrapClass( $this->msg( 'parentheses' )->rawParams( $wlhLink )->escaped(), 'mw-whatlinkshere-tools' @@ -370,18 +370,29 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { return Xml::closeElement( 'ul' ); } - protected function wlhLink( Title $target, $text ) { + protected function wlhLink( Title $target, $text, $editText ) { static $title = null; if ( $title === null ) { $title = $this->getPageTitle(); } + $editLink = ''; + if ( $this->getUser()->isAllowed( 'edit' ) ) { + $editLink = $this->msg( 'pipe-separator' )->escaped() . + Linker::linkKnown( + $target, + $editText, + array(), + array( 'action' => 'edit' ) + ); + } + return Linker::linkKnown( $title, $text, array(), array( 'target' => $target->getPrefixedText() ) - ); + ) . $editLink; } function makeSelfLink( $text, $query ) { -- 2.20.1