MediaWiki
REL1_35
HTMLFormElement.php
Go to the documentation of this file.
1
<?php
2
12
trait
HTMLFormElement
{
13
14
protected
$hideIf =
null
;
15
protected
$modules
=
null
;
16
17
public
function
initializeHTMLFormElement
( array $config = [] ) {
18
// Properties
19
$this->hideIf = $config[
'hideIf'
] ??
null
;
20
$this->modules = $config[
'modules'
] ?? [];
21
22
// Initialization
23
if
( $this->hideIf ) {
24
$this->addClasses( [
'mw-htmlform-hide-if'
] );
25
}
26
if
( $this->modules ) {
27
// JS code must be able to read this before infusing (before OOUI is even loaded),
28
// so we put this in a separate attribute (not with the rest of the config).
29
// And it's not needed anymore after infusing, so we don't put it in JS config at all.
30
$this->setAttributes( [
'data-mw-modules'
=> implode(
','
, $this->modules ) ] );
31
}
32
$this->registerConfigCallback(
function
( &$config ) {
33
if
( $this->hideIf !==
null
) {
34
$config[
'hideIf'
] = $this->hideIf;
35
}
36
} );
37
}
38
}
initializeHTMLFormElement
initializeHTMLFormElement(array $config=[])
Definition
HTMLFormElement.php:17
$modules
$modules
Definition
HTMLFormElement.php:15
HTMLFormElement
trait HTMLFormElement
Allows custom data specific to HTMLFormField to be set for OOUI forms.
Definition
HTMLFormElement.php:12
includes
htmlform
HTMLFormElement.php
Generated on Sat Apr 6 2024 00:07:16 for MediaWiki by
1.9.8