Merge "Improve docs for Title::getInternalURL/getCanonicalURL"
[lhc/web/wiklou.git] / includes / widget / SelectWithInputWidget.php
index 994906a..de0e4a6 100644 (file)
@@ -1,17 +1,15 @@
 <?php
-/**
- * MediaWiki Widgets – SelectWithInputWidget class.
- *
- * @copyright 2011-2017 MediaWiki Widgets Team and others; see AUTHORS.txt
- * @license The MIT License (MIT); see LICENSE.txt
- */
+
 namespace MediaWiki\Widget;
 
-use \OOUI\TextInputWidget;
-use \OOUI\DropdownInputWidget;
+use OOUI\DropdownInputWidget;
+use OOUI\TextInputWidget;
 
 /**
  * Select and input widget.
+ *
+ * @copyright 2011-2017 MediaWiki Widgets Team and others; see AUTHORS.txt
+ * @license MIT
  */
 class SelectWithInputWidget extends \OOUI\Widget {
 
@@ -25,7 +23,7 @@ class SelectWithInputWidget extends \OOUI\Widget {
         *   - array $config['textinput'] Configuration for the TextInputWidget
         *   - array $config['dropdowninput'] Configuration for the DropdownInputWidget
         *   - bool $config['or'] Configuration for whether the widget is dropdown AND input
-        *                              or dropdown OR input
+        *       or dropdown OR input
         */
        public function __construct( array $config = [] ) {
                // Configuration initialization
@@ -38,6 +36,11 @@ class SelectWithInputWidget extends \OOUI\Widget {
                        $config
                );
 
+               if ( isset( $config['disabled'] ) && $config['disabled'] ) {
+                       $config['textinput']['disabled'] = true;
+                       $config['dropdowninput']['disabled'] = true;
+               }
+
                parent::__construct( $config );
 
                // Properties