If an image has a title but isn't linked, set the title on the image
itself rather than not setting it at all.
Bug: T23454
Change-Id: I6302246cf28c84ade805a6a7d4a5e131b6f42e86
$query = isset( $options['desc-query'] ) ? $options['desc-query'] : '';
+ $attribs = array(
+ 'alt' => $alt,
+ 'src' => $this->url,
+ );
+
if ( !empty( $options['custom-url-link'] ) ) {
$linkAttribs = array( 'href' => $options['custom-url-link'] );
if ( !empty( $options['title'] ) ) {
$linkAttribs = array( 'href' => $this->file->getURL() );
} else {
$linkAttribs = false;
+ if ( !empty( $options['title'] ) ) {
+ $attribs['title'] = $options['title'];
+ }
}
- $attribs = array(
- 'alt' => $alt,
- 'src' => $this->url,
- );
-
if ( empty( $options['no-dimensions'] ) ) {
$attribs['width'] = $this->width;
$attribs['height'] = $this->height;
</figcaption></figure>
!! end
+!! test
+Titles in unlinked images (T23454)
+!! wikitext
+[[File:Foobar.jpg|link=|stuff]]
+!! html/php
+<p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
+</p>
+!! end
+
!! test
Link with empty target
!! wikitext