'section' => 'source',
'type' => 'file',
'id' => 'wpUploadFile',
+ 'radio-id' => 'wpSourceTypeFile',
'label-message' => 'sourcefilename',
'upload-type' => 'File',
'radio' => &$radio,
'class' => 'UploadSourceField',
'section' => 'source',
'id' => 'wpUploadFileURL',
+ 'radio-id' => 'wpSourceTypeurl',
'label-message' => 'sourceurl',
'upload-type' => 'url',
'radio' => &$radio,
* @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']}";
+ if ( isset( $this->mParams['radio-id'] ) ) {
+ $radioId = $this->mParams['radio-id'];
+ } else {
+ // Old way. For the benefit of extensions that do not define
+ // the 'radio-id' key.
+ $radioId = 'wpSourceType' . $this->mParams['upload-type'];
+ }
+
$attribs = array(
'name' => 'wpSourceType',
'type' => 'radio',
- 'id' => $id,
+ 'id' => $radioId,
'value' => $this->mParams['upload-type'],
);
+
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 );
}