summaryrefslogtreecommitdiff
path: root/vendor/oojs/oojs-ui/php/widgets/DropdownInputWidget.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/oojs/oojs-ui/php/widgets/DropdownInputWidget.php')
-rw-r--r--vendor/oojs/oojs-ui/php/widgets/DropdownInputWidget.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/vendor/oojs/oojs-ui/php/widgets/DropdownInputWidget.php b/vendor/oojs/oojs-ui/php/widgets/DropdownInputWidget.php
index ae541a66..f8ea48a3 100644
--- a/vendor/oojs/oojs-ui/php/widgets/DropdownInputWidget.php
+++ b/vendor/oojs/oojs-ui/php/widgets/DropdownInputWidget.php
@@ -23,6 +23,10 @@ class DropdownInputWidget extends InputWidget {
// Parent constructor
parent::__construct( $config );
+ // Mixins
+ $this->mixin( new TitledElement( $this,
+ array_merge( $config, array( 'titled' => $this->input ) ) ) );
+
// Initialization
$this->setOptions( isset( $config['options'] ) ? $config['options'] : array() );
$this->addClasses( array( 'oo-ui-dropdownInputWidget' ) );
@@ -60,11 +64,12 @@ class DropdownInputWidget extends InputWidget {
// Rebuild the dropdown menu
$this->input->clearContent();
foreach ( $options as $opt ) {
+ $optValue = $this->cleanUpValue( $opt['data'] );
$option = new Tag( 'option' );
- $option->setAttributes( array( 'value' => $opt['data'] ) );
- $option->appendContent( isset( $opt['label'] ) ? $opt['label'] : $opt['data'] );
+ $option->setAttributes( array( 'value' => $optValue ) );
+ $option->appendContent( isset( $opt['label'] ) ? $opt['label'] : $optValue );
- if ( $value === $opt['data'] ) {
+ if ( $value === $optValue ) {
$isValueAvailable = true;
}