MediaWiki:Pagenumber-#-PAGENAME where # is the page's namespace number and
PAGENAME is the page name minus the namespace prefix. Can be disabled with
the new magic word __NOHEADER__
-* Added "click" parameter to image links, to allow images to link to an
+* Added "link" parameter to image links, to allow images to link to an
arbitrary title or URL. This should replace inaccessible and incomplete
solutions such as CSS-based overlays and ImageMap.
* bottom, text-bottom)
* alt Alternate text for image (i.e. alt attribute). Plain text.
* caption HTML for image caption.
- * click-url URL to link to
- * click-title Title object to link to
+ * link-url URL to link to
+ * link-title Title object to link to
* no-link Boolean, suppress description link
*
* @param array $handlerParams Associative array of media handler parameters, to be passed
'alt' => $fp['alt'],
'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false ,
'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false );
- if ( !empty( $fp['click-url'] ) ) {
- $params['custom-url-link'] = $fp['click-url'];
- } elseif ( !empty( $fp['click-title'] ) ) {
- $params['custom-title-link'] = $fp['click-title'];
+ if ( !empty( $fp['link-url'] ) ) {
+ $params['custom-url-link'] = $fp['link-url'];
+ } elseif ( !empty( $fp['link-title'] ) ) {
+ $params['custom-title-link'] = $fp['link-title'];
} elseif ( !empty( $fp['no-link'] ) ) {
// No link
} else {
'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle',
'bottom', 'text-bottom' ),
'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless',
- 'upright', 'border', 'click' ),
+ 'upright', 'border', 'link' ),
);
static $internalParamMap;
if ( !$internalParamMap ) {
/// downstream behavior seems odd with missing manual thumbs.
$validated = true;
break;
- case 'click':
+ case 'link':
$chars = self::EXT_LINK_URL_CLASS;
$prots = $this->mUrlProtocols;
if ( $value === '' ) {
$validated = true;
} elseif ( preg_match( "/^$prots/", $value ) ) {
if ( preg_match( "/^($prots)$chars+$/", $value, $m ) ) {
- $paramName = 'click-url';
+ $paramName = 'link-url';
$this->mOutput->addExternalLink( $value );
$validated = true;
}
} else {
- $clickTitle = Title::newFromText( $value );
- if ( $clickTitle ) {
- $paramName = 'click-title';
- $value = $clickTitle;
- $this->mOutput->addLink( $clickTitle );
+ $linkTitle = Title::newFromText( $value );
+ if ( $linkTitle ) {
+ $paramName = 'link-title';
+ $value = $linkTitle;
+ $this->mOutput->addLink( $linkTitle );
$validated = true;
}
}
'img_middle' => array( 1, 'middle' ),
'img_bottom' => array( 1, 'bottom' ),
'img_text_bottom' => array( 1, 'text-bottom' ),
- 'img_click' => array( 1, 'click=$1' ),
+ 'img_link' => array( 1, 'link=$1' ),
'int' => array( 0, 'INT:' ),
'sitename' => array( 1, 'SITENAME' ),
'ns' => array( 0, 'NS:' ),
!! end
+!! test
+Image with link parameter, wiki target
+!! input
+[[Image:foobar.jpg|link=Target page]]
+!! result
+<p><a href="/wiki/Target_page" title="Target page"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
+</p>
+!! end
+
+!! test
+Image with link parameter, URL target
+!! input
+[[Image:foobar.jpg|link=http://example.com/]]
+!! result
+<p><a href="http://example.com/"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
+</p>
+!! end
+
+!! test
+Image with empty link parameter
+!! input
+[[Image:foobar.jpg|link=]]
+!! result
+<p><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" />
+</p>
+!! end
+
+
+
!! test
Image with frame and link
!! input