diff options
Diffstat (limited to 'includes/widget/OrderedMultiselectWidget.php')
-rw-r--r-- | includes/widget/OrderedMultiselectWidget.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/includes/widget/OrderedMultiselectWidget.php b/includes/widget/OrderedMultiselectWidget.php new file mode 100644 index 000000000000..fbf9e8a060c6 --- /dev/null +++ b/includes/widget/OrderedMultiselectWidget.php @@ -0,0 +1,32 @@ +<?php + +namespace MediaWiki\Widget; + +/** + * Widget to select multiple options from a dropdown. + * + * @license MIT + */ +class OrderedMultiselectWidget extends TagMultiselectWidget { + + private array $mOptions; + + /** + * @param array $config Configuration options + * - array $config['options'] Grouped options for the dropdown menu + */ + public function __construct( $config ) { + $this->mOptions = $config['options']; + parent::__construct( $config ); + } + + public function getConfig( &$config ) { + $config['options'] = $this->mOptions; + + return parent::getConfig( $config ); + } + + protected function getJavaScriptClassName() { + return 'mw.widgets.OrderedMultiselectWidget'; + } +} |