MediaWiki
master
Toggle main menu visibility
HTMLInfoField.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\HTMLForm\Field;
4
5
use Closure;
6
use MediaWiki\HTMLForm\HTMLFormField;
7
12
class
HTMLInfoField
extends
HTMLFormField
{
24
public
function
__construct
( $info ) {
25
$info[
'nodata'
] =
true
;
26
27
parent::__construct( $info );
28
}
29
34
public
function
getDefault
() {
35
$default = parent::getDefault();
36
if
( $default instanceof Closure ) {
37
$default = $default( $this->mParams );
38
}
39
return
$default;
40
}
41
46
public
function
getInputHTML
( $value ) {
47
return
!empty( $this->mParams[
'raw'
] ) ? $value : htmlspecialchars( $value );
48
}
49
54
public
function
getInputOOUI
( $value ) {
55
if
( !empty( $this->mParams[
'raw'
] ) ) {
56
$value = new \OOUI\HtmlSnippet( $value );
57
}
58
59
return
(
new
\OOUI\LabelWidget( [
60
'label'
=> $value,
61
'id'
=> $this->mID
62
] ) )
63
// In case the information text contains any form elements, avoid treating it
64
// as a clickable label (T428359). Maybe it shouldn't be a `<label>` in the first placeā¦
65
->setAttributes( [
'for'
=>
''
] );
66
}
67
72
public
function
getTableRow
( $value ) {
73
if
( !empty( $this->mParams[
'rawrow'
] ) ) {
74
return
$value;
75
}
76
77
return
parent::getTableRow( $value );
78
}
79
86
public
function
getDiv
( $value ) {
87
if
( !empty( $this->mParams[
'rawrow'
] ) ) {
88
return
$value;
89
}
90
91
return
parent::getDiv( $value );
92
}
93
100
public
function
getRaw
( $value ) {
101
if
( !empty( $this->mParams[
'rawrow'
] ) ) {
102
return
$value;
103
}
104
105
return
parent::getRaw( $value );
106
}
107
114
public
function
getOOUI
( $value ) {
115
if
( !empty( $this->mParams[
'rawrow'
] ) ) {
116
if
( !( $value instanceof \OOUI\FieldLayout ) ) {
117
wfDeprecatedMsg
( __METHOD__ .
": 'default' parameter as a string when using "
.
118
"'rawrow' was deprecated in MediaWiki 1.32 (must be a FieldLayout or subclass)"
,
119
'1.32'
);
120
}
121
return
$value;
122
}
123
124
return
parent::getOOUI( $value );
125
}
126
128
public
function
getCodex
( $value ) {
129
if
( !empty( $this->mParams[
'rawrow'
] ) ) {
130
return
$value;
131
}
132
133
return
parent::getCodex( $value );
134
}
135
140
protected
function
needsLabel
() {
141
return
false
;
142
}
143
}
144
146
class_alias( HTMLInfoField::class,
'HTMLInfoField'
);
wfDeprecatedMsg
wfDeprecatedMsg( $msg, $version=false, $component=false, $callerOffset=2)
Log a deprecation warning with arbitrary message text.
Definition
GlobalFunctions.php:494
MediaWiki\HTMLForm\Field\HTMLInfoField
An information field (text blob), not a proper input.
Definition
HTMLInfoField.php:12
MediaWiki\HTMLForm\Field\HTMLInfoField\getTableRow
getTableRow( $value)
Get the complete table row for the input, including help text, labels, and whatever....
Definition
HTMLInfoField.php:72
MediaWiki\HTMLForm\Field\HTMLInfoField\getDefault
getDefault()
to override mixed
Definition
HTMLInfoField.php:34
MediaWiki\HTMLForm\Field\HTMLInfoField\needsLabel
needsLabel()
Should this field have a label, or is there no input element with the appropriate id for the label to...
Definition
HTMLInfoField.php:140
MediaWiki\HTMLForm\Field\HTMLInfoField\getDiv
getDiv( $value)
Definition
HTMLInfoField.php:86
MediaWiki\HTMLForm\Field\HTMLInfoField\getOOUI
getOOUI( $value)
Definition
HTMLInfoField.php:114
MediaWiki\HTMLForm\Field\HTMLInfoField\getRaw
getRaw( $value)
Definition
HTMLInfoField.php:100
MediaWiki\HTMLForm\Field\HTMLInfoField\getCodex
getCodex( $value)
Get the Codex version of the div.1.42string HTML
Definition
HTMLInfoField.php:128
MediaWiki\HTMLForm\Field\HTMLInfoField\getInputOOUI
getInputOOUI( $value)
Same as getInputHTML, but returns an OOUI object.Defaults to false, which getOOUI will interpret as "...
Definition
HTMLInfoField.php:54
MediaWiki\HTMLForm\Field\HTMLInfoField\__construct
__construct( $info)
Definition
HTMLInfoField.php:24
MediaWiki\HTMLForm\Field\HTMLInfoField\getInputHTML
getInputHTML( $value)
This function must be implemented to return the HTML to generate the input object itself....
Definition
HTMLInfoField.php:46
MediaWiki\HTMLForm\HTMLFormField
The parent class to generate form fields.
Definition
HTMLFormField.php:28
includes
HTMLForm
Field
HTMLInfoField.php
Generated on
for MediaWiki by
1.18.0