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