From d54e76a9b0a56ac0467482a263ce354fac86940a Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 8 Oct 2013 15:15:03 +0400 Subject: [PATCH] (bug 40889) Follow-up 6f1d4db3: Fix the upload form when radio buttons are shown. The previous change had broken the upload form if URL uploads or some other possible upload source types are enabled - i.e. in the case when there are radio buttons. The "incorrect" label ID was used by radiobutton. Change-Id: I7c15fd4250b6a2d26af2cc0373da5ac6c884d690 --- includes/specials/SpecialUpload.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 5e1591d918..7c05001fb0 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -1107,10 +1107,8 @@ class UploadSourceField extends HTMLTextField { * @return string */ function getLabelHtml( $cellAttributes = array() ) { - $id = $this->mParams['id']; - $label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel ); - if ( !empty( $this->mParams['radio'] ) ) { + $id = "wpSourceType{$this->mParams['upload-type']}"; $attribs = array( 'name' => 'wpSourceType', 'type' => 'radio', @@ -1120,9 +1118,12 @@ class UploadSourceField extends HTMLTextField { if ( !empty( $this->mParams['checked'] ) ) { $attribs['checked'] = 'checked'; } + $label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel ); $label .= Html::element( 'input', $attribs ); + } else { + $id = $this->mParams['id']; + $label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel ); } - return Html::rawElement( 'td', array( 'class' => 'mw-label' ) + $cellAttributes, $label ); } -- 2.20.1