From da2aa30f1d235e5f523a7c794a8aaeec3b16838e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 8 Dec 2006 23:07:06 +0000 Subject: [PATCH] * Allow Xml::check() $attribs parameter to override 'value' attribute PHP's array + operator doesn't overwrite items from the left side when keys conflict. Switch to array_merge() here, which acts as expected. --- RELEASE-NOTES | 1 + includes/Xml.php | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0157af69c8..85e66dae45 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -253,6 +253,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added redirect to section feature. Use it wisely. * Added a configuration variable allowing the "break out of framesets" feature to be switched on and off ($wgBreakFrames). Off by default. +* Allow Xml::check() $attribs parameter to override 'value' attribute == Languages updated == diff --git a/includes/Xml.php b/includes/Xml.php index 509ed9a68c..25c23ed3b2 100644 --- a/includes/Xml.php +++ b/includes/Xml.php @@ -128,10 +128,13 @@ class Xml { * @return string HTML */ public static function check( $name, $checked=false, $attribs=array() ) { - return self::element( 'input', array( - 'name' => $name, - 'type' => 'checkbox', - 'value' => 1 ) + self::attrib( 'checked', $checked ) + $attribs ); + return self::element( 'input', array_merge( + array( + 'name' => $name, + 'type' => 'checkbox', + 'value' => 1 ), + self::attrib( 'checked', $checked ), + $attribs ) ); } /** -- 2.20.1