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