From: Aryeh Gregor
Date: Fri, 15 May 2009 19:43:09 +0000 (+0000)
Subject: (bug 16912) Tooltips on images with link= disappear
X-Git-Tag: 1.31.0-rc.0~41786
X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=2369b1181082602bfa51cbbcf3a477b8fea092d4;p=lhc%2Fweb%2Fwiklou.git
(bug 16912) Tooltips on images with link= disappear
Patch based on one by Derk-Jan Hartman, which he wasn't able to commit
because he didn't have a MediaWiki installation to test on. One fix
made, and parser tests added.
---
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 2da583e3a2..94a8a9fa6d 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -121,6 +121,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
tweaked spacing.
* (bug 18656) Use proper directory separators in wfMkdirParents()
* (bug 18549) Make Special:Blockip respect $wgEnableUserEmail and $wgSysopEmailBans
+* (bug 16912) Tooltips on images with link= disappear
== API changes in 1.16 ==
diff --git a/includes/MediaTransformOutput.php b/includes/MediaTransformOutput.php
index d620a586b8..9c0d121d0b 100644
--- a/includes/MediaTransformOutput.php
+++ b/includes/MediaTransformOutput.php
@@ -153,14 +153,18 @@ class ThumbnailImage extends MediaTransformOutput {
$alt = empty( $options['alt'] ) ? '' : $options['alt'];
# Note: if title is empty and alt is not, make the title empty, don't
# use alt; only use alt if title is not set
- $title = !isset( $options['title'] ) ? $alt : $options['title'];
+ $title = !isset( $options['title'] ) ? $alt : $options['title'];
$query = empty($options['desc-query']) ? '' : $options['desc-query'];
if ( !empty( $options['custom-url-link'] ) ) {
$linkAttribs = array( 'href' => $options['custom-url-link'] );
+ if ( $alt ) {
+ $linkAttribs['title'] = $alt;
+ }
} elseif ( !empty( $options['custom-title-link'] ) ) {
$title = $options['custom-title-link'];
- $linkAttribs = array( 'href' => $title->getLinkUrl(), 'title' => $title->getFullText() );
+ $linkAttribs = array( 'href' => $title->getLinkUrl(),
+ 'title' => empty( $options['alt'] ) ? $title->getFullText() : $alt );
} elseif ( !empty( $options['desc-link'] ) ) {
$linkAttribs = $this->getDescLinkAttribs( $title, $query );
} elseif ( !empty( $options['file-link'] ) ) {
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 298fc6a018..b4be06d63b 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -3188,6 +3188,24 @@ Image with empty link parameter
!! end
+!! test
+Image with link parameter (wiki target) and unnamed parameter
+!! input
+[[Image:foobar.jpg|link=Target page|Title]]
+!! result
+
+
+!! end
+
+!! test
+Image with link parameter (URL target) and unnamed parameter
+!! input
+[[Image:foobar.jpg|link=http://example.com/|Title]]
+!! result
+
+
+!! end
+
!! test