MediaWiki REL1_37
HTMLInfoField.php
Go to the documentation of this file.
1<?php
2
19 public function __construct( $info ) {
20 $info['nodata'] = true;
21
22 parent::__construct( $info );
23 }
24
29 public function getDefault() {
30 $default = parent::getDefault();
31 if ( $default instanceof Closure ) {
32 $default = $default( $this->mParams );
33 }
34 return $default;
35 }
36
41 public function getInputHTML( $value ) {
42 return !empty( $this->mParams['raw'] ) ? $value : htmlspecialchars( $value );
43 }
44
49 public function getInputOOUI( $value ) {
50 if ( !empty( $this->mParams['raw'] ) ) {
51 $value = new OOUI\HtmlSnippet( $value );
52 }
53
54 return new OOUI\LabelWidget( [
55 'label' => $value,
56 ] );
57 }
58
63 public function getTableRow( $value ) {
64 if ( !empty( $this->mParams['rawrow'] ) ) {
65 return $value;
66 }
67
68 return parent::getTableRow( $value );
69 }
70
77 public function getDiv( $value ) {
78 if ( !empty( $this->mParams['rawrow'] ) ) {
79 return $value;
80 }
81
82 return parent::getDiv( $value );
83 }
84
91 public function getRaw( $value ) {
92 if ( !empty( $this->mParams['rawrow'] ) ) {
93 return $value;
94 }
95
96 return parent::getRaw( $value );
97 }
98
105 public function getOOUI( $value ) {
106 if ( !empty( $this->mParams['rawrow'] ) ) {
107 if ( !( $value instanceof OOUI\FieldLayout ) ) {
108 wfDeprecatedMsg( __METHOD__ . ": 'default' parameter as a string when using " .
109 "'rawrow' was deprecated in MediaWiki 1.32 (must be a FieldLayout or subclass)",
110 '1.32' );
111 }
112 return $value;
113 }
114
115 return parent::getOOUI( $value );
116 }
117
122 protected function needsLabel() {
123 return false;
124 }
125}
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
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....
getDefault()
to override mixed
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.Defaults to false, which getOOUI will interpret as "...
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)