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