* Add lang and hreflang attributes to language links on Login page.
* (bug 22749) Create Special:MostInterwikis.
* Show change tags when transclude Special:Recentchanges(linked) or Special:Newpages.
+* (bug 23226) Add |class= parameter to image links in order to add class(es) to HTML img tag.
=== Bug fixes in 1.20 ===
* (bug 30245) Use the correct way to construct a log page title.
* valign Vertical alignment (baseline, sub, super, top, text-top, middle,
* bottom, text-bottom)
* alt Alternate text for image (i.e. alt attribute). Plain text.
+ * class HTML for image classes. Plain text.
* caption HTML for image caption.
* link-url URL to link to
* link-title Title object to link to
if ( !isset( $fp['title'] ) ) {
$fp['title'] = '';
}
+ if ( !isset( $fp['class'] ) ) {
+ $fp['class'] = '';
+ }
$prefix = $postfix = '';
$params = array(
'alt' => $fp['alt'],
'title' => $fp['title'],
- 'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false ,
- 'img-class' => isset( $fp['border'] ) ? 'thumbborder' : false );
+ 'valign' => isset( $fp['valign'] ) ? $fp['valign'] : false,
+ 'img-class' => $fp['class'] );
+ if ( isset( $fp['border'] ) ) {
+ $params['img-class'] .= ( $params['img-class'] !== '' ) ? ' thumbborder' : 'thumbborder';
+ }
$params = self::getImageLinkMTOParams( $fp, $query, $parser ) + $params;
$s = $thumb->toHtml( $params );
$params = array(
'alt' => $fp['alt'],
'title' => $fp['title'],
- 'img-class' => 'thumbimage' );
+ 'img-class' => ( isset( $fp['class'] ) && $fp['class'] !== '' ) ? $fp['class'] . ' thumbimage' : 'thumbimage'
+ );
$params = self::getImageLinkMTOParams( $fp, $query ) + $params;
$s .= $thumb->toHtml( $params );
if ( isset( $fp['framed'] ) ) {
'vertAlign' => array( 'baseline', 'sub', 'super', 'top', 'text-top', 'middle',
'bottom', 'text-bottom' ),
'frame' => array( 'thumbnail', 'manualthumb', 'framed', 'frameless',
- 'upright', 'border', 'link', 'alt' ),
+ 'upright', 'border', 'link', 'alt', 'class' ),
);
static $internalParamMap;
if ( !$internalParamMap ) {
# * upright reduce width for upright images, rounded to full __0 px
# * border draw a 1px border around the image
# * alt Text for HTML alt attribute (defaults to empty)
+ # * class Set a class for img node
# * link Set the target of the image link. Can be external, interwiki, or local
# vertical-align values (no % or length right now):
# * baseline
switch( $paramName ) {
case 'manualthumb':
case 'alt':
+ case 'class':
# @todo FIXME: Possibly check validity here for
# manualthumb? downstream behavior seems odd with
# missing manual thumbs.
'img_text_bottom' => array( 1, 'text-bottom' ),
'img_link' => array( 1, 'link=$1' ),
'img_alt' => array( 1, 'alt=$1' ),
+ 'img_class' => array( 1, 'class=$1' ),
'int' => array( 0, 'INT:' ),
'sitename' => array( 1, 'SITENAME' ),
'ns' => array( 0, 'NS:' ),
!! end
+!! test
+Custom class
+!! input
+[[Image:foobar.jpg|a|class=b]]
+!! result
+<p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
+</p>
+!! end
+
!! article
File:Barfoo.jpg
!! text