From: Florianschmidtwelzow Date: Mon, 27 Apr 2015 05:34:15 +0000 (+0200) Subject: Add edit link to each row on Special:WhatLinksHere X-Git-Tag: 1.31.0-rc.0~10707^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=567f127179e7f77c17d96a6154788651b8970b60;p=lhc%2Fweb%2Fwiklou.git Add edit link to each row on Special:WhatLinksHere Bug: T97269 Change-Id: Ic13b775bc0c0ede947086c7eb305ac5d4f2fcd12 --- 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 ) {