diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2009-02-22 13:37:51 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2009-02-22 13:37:51 +0100 |
commit | b9b85843572bf283f48285001e276ba7e61b63f6 (patch) | |
tree | 4c6f4571552ada9ccfb4030481dcf77308f8b254 /includes/MediaTransformOutput.php | |
parent | d9a20acc4e789cca747ad360d87ee3f3e7aa58c1 (diff) |
updated to MediaWiki 1.14.0
Diffstat (limited to 'includes/MediaTransformOutput.php')
-rw-r--r-- | includes/MediaTransformOutput.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/includes/MediaTransformOutput.php b/includes/MediaTransformOutput.php index 9e94f06b..0367494f 100644 --- a/includes/MediaTransformOutput.php +++ b/includes/MediaTransformOutput.php @@ -50,6 +50,8 @@ abstract class MediaTransformOutput { * alt Alternate text or caption * desc-link Boolean, show a description link * file-link Boolean, show a file download link + * custom-url-link Custom URL to link to + * custom-title-link Custom Title object to link to * valign vertical-align property, if the output is an inline element * img-class Class applied to the <img> tag, if there is such a tag * @@ -127,12 +129,15 @@ class ThumbnailImage extends MediaTransformOutput { * should be indicated with a value of true for true, and false or * absent for false. * - * alt Alternate text or caption + * alt HTML alt attribute + * title HTML title attribute * desc-link Boolean, show a description link * file-link Boolean, show a file download link * valign vertical-align property, if the output is an inline element * img-class Class applied to the <img> tag, if there is such a tag * desc-query String, description link query params + * custom-url-link Custom URL to link to + * custom-title-link Custom Title object to link to * * For images, desc-link and file-link are implemented as a click-through. For * sounds and videos, they may be displayed in other ways. @@ -146,9 +151,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']; $query = empty($options['desc-query']) ? '' : $options['desc-query']; - if ( !empty( $options['desc-link'] ) ) { - $linkAttribs = $this->getDescLinkAttribs( $alt, $query ); + + if ( !empty( $options['custom-url-link'] ) ) { + $linkAttribs = array( 'href' => $options['custom-url-link'] ); + } elseif ( !empty( $options['custom-title-link'] ) ) { + $title = $options['custom-title-link']; + $linkAttribs = array( 'href' => $title->getLinkUrl(), 'title' => $title->getFullText() ); + } elseif ( !empty( $options['desc-link'] ) ) { + $linkAttribs = $this->getDescLinkAttribs( $title, $query ); } elseif ( !empty( $options['file-link'] ) ) { $linkAttribs = array( 'href' => $this->file->getURL() ); } else { |