MediaWiki
master
HTMLFormElement.php
Go to the documentation of this file.
1
<?php
2
3
// @phan-file-suppress PhanUndeclaredMethod
4
5
namespace
MediaWiki\HTMLForm
;
6
15
trait
HTMLFormElement
{
16
18
protected
$condState =
null
;
20
protected
$modules
=
null
;
21
22
public
function
initializeHTMLFormElement
( array $config = [] ) {
23
// Properties
24
$this->condState = $config[
'condState'
] ?? [];
25
$this->modules = $config[
'modules'
] ?? [];
26
27
// Initialization
28
if
( $this->modules ) {
29
// JS code must be able to read this before infusing (before OOUI is even loaded),
30
// so we put this in a separate attribute (not with the rest of the config).
31
// And it's not needed anymore after infusing, so we don't put it in JS config at all.
32
$this->setAttributes( [
'data-mw-modules'
=> implode(
','
, $this->modules ) ] );
33
}
34
$this->registerConfigCallback(
function
( &$config ) {
35
if
( $this->condState ) {
36
$config[
'condState'
] = $this->condState;
37
}
38
} );
39
}
40
}
41
43
class_alias( HTMLFormElement::class,
'HTMLFormElement'
);
MediaWiki\HTMLForm
Definition
CodexHTMLForm.php:10
MediaWiki\HTMLForm\initializeHTMLFormElement
initializeHTMLFormElement(array $config=[])
Definition
HTMLFormElement.php:22
MediaWiki\HTMLForm\HTMLFormElement
trait HTMLFormElement
Allows custom data specific to HTMLFormField to be set for OOUI forms.
Definition
HTMLFormElement.php:15
MediaWiki\HTMLForm\$modules
array null $modules
Definition
HTMLFormElement.php:20
includes
HTMLForm
HTMLFormElement.php
Generated on Fri Nov 7 2025 01:25:34 for MediaWiki by
1.10.0