MediaWiki REL1_30
HTMLInfoField.php
Go to the documentation of this file.
1<?php
2
16 public function __construct( $info ) {
17 $info['nodata'] = true;
18
19 parent::__construct( $info );
20 }
21
22 public function getDefault() {
23 $default = parent::getDefault();
24 if ( $default instanceof Closure ) {
25 $default = call_user_func( $default, $this->mParams );
26 }
27 return $default;
28 }
29
30 public function getInputHTML( $value ) {
31 return !empty( $this->mParams['raw'] ) ? $value : htmlspecialchars( $value );
32 }
33
34 public function getInputOOUI( $value ) {
35 if ( !empty( $this->mParams['raw'] ) ) {
36 $value = new OOUI\HtmlSnippet( $value );
37 }
38
39 return new OOUI\LabelWidget( [
40 'label' => $value,
41 ] );
42 }
43
44 public function getTableRow( $value ) {
45 if ( !empty( $this->mParams['rawrow'] ) ) {
46 return $value;
47 }
48
49 return parent::getTableRow( $value );
50 }
51
57 public function getDiv( $value ) {
58 if ( !empty( $this->mParams['rawrow'] ) ) {
59 return $value;
60 }
61
62 return parent::getDiv( $value );
63 }
64
70 public function getRaw( $value ) {
71 if ( !empty( $this->mParams['rawrow'] ) ) {
72 return $value;
73 }
74
75 return parent::getRaw( $value );
76 }
77
78 protected function needsLabel() {
79 return false;
80 }
81}
The parent class to generate form fields.
An information field (text blob), not a proper input.
getTableRow( $value)
Get the complete table row for the input, including help text, labels, and whatever.
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself.
needsLabel()
Should this field have a label, or is there no input element with the appropriate id for the label to...
__construct( $info)