summaryrefslogtreecommitdiff
path: root/includes/MediaTransformOutput.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/MediaTransformOutput.php')
-rw-r--r--includes/MediaTransformOutput.php30
1 files changed, 16 insertions, 14 deletions
diff --git a/includes/MediaTransformOutput.php b/includes/MediaTransformOutput.php
index 0367494f..a3fcc96e 100644
--- a/includes/MediaTransformOutput.php
+++ b/includes/MediaTransformOutput.php
@@ -80,20 +80,19 @@ abstract class MediaTransformOutput {
}
}
- function getDescLinkAttribs( $alt = false, $params = '' ) {
+ function getDescLinkAttribs( $title = null, $params = '' ) {
$query = $this->page ? ( 'page=' . urlencode( $this->page ) ) : '';
if( $params ) {
$query .= $query ? '&'.$params : $params;
}
- $title = $this->file->getTitle();
- if ( strval( $alt ) === '' ) {
- $alt = $title->getText();
- }
- return array(
+ $attribs = array(
'href' => $this->file->getTitle()->getLocalURL( $query ),
'class' => 'image',
- 'title' => $alt
);
+ if ( $title ) {
+ $attribs['title'] = $title;
+ }
+ return $attribs;
}
}
@@ -151,18 +150,22 @@ 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'];
- $query = empty($options['desc-query']) ? '' : $options['desc-query'];
+
+ $query = empty( $options['desc-query'] ) ? '' : $options['desc-query'];
if ( !empty( $options['custom-url-link'] ) ) {
$linkAttribs = array( 'href' => $options['custom-url-link'] );
+ if ( !empty( $options['title'] ) ) {
+ $linkAttribs['title'] = $options['title'];
+ }
} 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['title'] ) ? $title->getFullText() : $options['title']
+ );
} elseif ( !empty( $options['desc-link'] ) ) {
- $linkAttribs = $this->getDescLinkAttribs( $title, $query );
+ $linkAttribs = $this->getDescLinkAttribs( empty( $options['title'] ) ? null : $options['title'], $query );
} elseif ( !empty( $options['file-link'] ) ) {
$linkAttribs = array( 'href' => $this->file->getURL() );
} else {
@@ -174,7 +177,6 @@ class ThumbnailImage extends MediaTransformOutput {
'src' => $this->url,
'width' => $this->width,
'height' => $this->height,
- 'border' => 0,
);
if ( !empty( $options['valign'] ) ) {
$attribs['style'] = "vertical-align: {$options['valign']}";