MediaWiki  master
HTMLFormElement.php
Go to the documentation of this file.
1 <?php
2 
13 
14  protected $condState = null;
15  protected $modules = null;
16 
17  public function initializeHTMLFormElement( array $config = [] ) {
18  // Properties
19  $this->condState = $config['condState'] ?? [];
20  $this->modules = $config['modules'] ?? [];
21 
22  // Initialization
23  if ( $this->modules ) {
24  // JS code must be able to read this before infusing (before OOUI is even loaded),
25  // so we put this in a separate attribute (not with the rest of the config).
26  // And it's not needed anymore after infusing, so we don't put it in JS config at all.
27  $this->setAttributes( [ 'data-mw-modules' => implode( ',', $this->modules ) ] );
28  }
29  $this->registerConfigCallback( function ( &$config ) {
30  if ( $this->condState ) {
31  $config['condState'] = $this->condState;
32  }
33  } );
34  }
35 }
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