MediaWiki master
MediaWiki\Widget\LanguageSelectWidget Class Reference

The Language Select Widget is a reusable component in PHP and JS. More...

Public Member Functions

 __construct (array $config=[])
 
 __toString ()
 Magic method to convert to string.
 
 toString ()
 Get the HTML output for the widget.
 

Detailed Description

The Language Select Widget is a reusable component in PHP and JS.

It automatically transforms native HTML <select> elements into the Codex language selector <LookupLanguageSelector> with the capabilities that <cdx-lookup> have, it also maintains backward compatibility with JavaScript disabled environments.

See also
https://phabricator.wikimedia.org/T415013
Note
2026 MediaWiki Widgets Team and others; see AUTHORS.txt
MIT

Definition at line 19 of file LanguageSelectWidget.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Widget\LanguageSelectWidget::__construct ( array $config = [])
Parameters
array$configConfiguration options
  • array|null $config['languages'] Array of language codes to language names. If null, JavaScript will use default supported languages.
  • string $config['name'] Name attribute for form submission
  • string $config['value'] Selected language code
  • string $config['id'] ID attribute for the select element
  • bool $config['disabled'] Whether the select is disabled
  • bool $config['required'] Whether the select is required
  • bool $config['multiple'] multi select language selector
  • string $config['cssclass'] Additional CSS classes for the select element

Definition at line 34 of file LanguageSelectWidget.php.

Member Function Documentation

◆ __toString()

MediaWiki\Widget\LanguageSelectWidget::__toString ( )

Magic method to convert to string.

Returns
string HTML

Definition at line 102 of file LanguageSelectWidget.php.

◆ toString()

MediaWiki\Widget\LanguageSelectWidget::toString ( )

Get the HTML output for the widget.

Returns
string HTML

Definition at line 43 of file LanguageSelectWidget.php.

Referenced by MediaWiki\HTMLForm\Field\HTMLSelectLanguageField\getInputCodex().


The documentation for this class was generated from the following file: