MediaWiki master
UploadSourceField.php
Go to the documentation of this file.
1<?php
22
26class UploadSourceField extends HTMLTextField {
27
32 public function getLabelHtml( $cellAttributes = [] ) {
33 $id = $this->mParams['id'];
34 $label = Html::rawElement( 'label', [ 'for' => $id ], $this->mLabel );
35
36 if ( !empty( $this->mParams['radio'] ) ) {
37 $radioId = $this->mParams['radio-id'] ??
38 // Old way. For the benefit of extensions that do not define
39 // the 'radio-id' key.
40 'wpSourceType' . $this->mParams['upload-type'];
41
42 $attribs = [
43 'name' => 'wpSourceType',
44 'type' => 'radio',
45 'id' => $radioId,
46 'value' => $this->mParams['upload-type'],
47 ];
48
49 if ( !empty( $this->mParams['checked'] ) ) {
50 $attribs['checked'] = 'checked';
51 }
52
53 $label .= Html::element( 'input', $attribs );
54 }
55
56 return Html::rawElement( 'td', [ 'class' => 'mw-label' ] + $cellAttributes, $label );
57 }
58
62 public function getSize() {
63 return $this->mParams['size'] ?? 60;
64 }
65}
This class is a collection of static functions that serve two purposes:
Definition Html.php:56
A form field that contains a radio box in the label.
getLabelHtml( $cellAttributes=[])