MediaWiki  1.34.4
UploadSourceField.php
Go to the documentation of this file.
1 <?php
25 
30  function getLabelHtml( $cellAttributes = [] ) {
31  $id = $this->mParams['id'];
32  $label = Html::rawElement( 'label', [ 'for' => $id ], $this->mLabel );
33 
34  if ( !empty( $this->mParams['radio'] ) ) {
35  $radioId = $this->mParams['radio-id'] ??
36  // Old way. For the benefit of extensions that do not define
37  // the 'radio-id' key.
38  'wpSourceType' . $this->mParams['upload-type'];
39 
40  $attribs = [
41  'name' => 'wpSourceType',
42  'type' => 'radio',
43  'id' => $radioId,
44  'value' => $this->mParams['upload-type'],
45  ];
46 
47  if ( !empty( $this->mParams['checked'] ) ) {
48  $attribs['checked'] = 'checked';
49  }
50 
51  $label .= Html::element( 'input', $attribs );
52  }
53 
54  return Html::rawElement( 'td', [ 'class' => 'mw-label' ] + $cellAttributes, $label );
55  }
56 
60  function getSize() {
61  return $this->mParams['size'] ?? 60;
62  }
63 }
UploadSourceField\getSize
getSize()
Definition: UploadSourceField.php:60
UploadSourceField
A form field that contains a radio box in the label.
Definition: UploadSourceField.php:24
HTMLTextField
<input> field.
Definition: HTMLTextField.php:11
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:209
UploadSourceField\getLabelHtml
getLabelHtml( $cellAttributes=[])
Definition: UploadSourceField.php:30
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231