X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fwidget%2FSelectWithInputWidget.php;h=a792172b23543e41151a2b7e9eeed4590098eb28;hb=9c7f6734c397a954b8eaa5ec73876f2b4bf92afb;hp=de0e4a63d172b549c240a77125c70d5dda4e3572;hpb=1c7c858461dba7a037ec55c4f460427f619b7203;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/widget/SelectWithInputWidget.php b/includes/widget/SelectWithInputWidget.php index de0e4a63d1..a792172b23 100644 --- a/includes/widget/SelectWithInputWidget.php +++ b/includes/widget/SelectWithInputWidget.php @@ -12,9 +12,12 @@ use OOUI\TextInputWidget; * @license MIT */ class SelectWithInputWidget extends \OOUI\Widget { - - protected $textinput = null; - protected $dropdowninput = null; + /** @var array */ + protected $config; + /** @var TextInputWidget */ + protected $textinput; + /** @var DropdownInputWidget */ + protected $dropdowninput; /** * A version of the SelectWithInputWidget, with `or` set to true. @@ -24,6 +27,7 @@ class SelectWithInputWidget extends \OOUI\Widget { * - array $config['dropdowninput'] Configuration for the DropdownInputWidget * - bool $config['or'] Configuration for whether the widget is dropdown AND input * or dropdown OR input + * - bool $config['required'] Configuration for whether the widget is a required input. */ public function __construct( array $config = [] ) { // Configuration initialization @@ -31,7 +35,8 @@ class SelectWithInputWidget extends \OOUI\Widget { [ 'textinput' => [], 'dropdowninput' => [], - 'or' => false + 'or' => false, + 'required' => false, ], $config ); @@ -41,6 +46,9 @@ class SelectWithInputWidget extends \OOUI\Widget { $config['dropdowninput']['disabled'] = true; } + $config['textinput']['required'] = $config['or'] ? false : $config['required']; + $config['dropdowninput']['required'] = $config['required']; + parent::__construct( $config ); // Properties @@ -63,6 +71,7 @@ class SelectWithInputWidget extends \OOUI\Widget { $config['dropdowninput'] = $this->config['dropdowninput']; $config['dropdowninput']['dropdown']['$overlay'] = true; $config['or'] = $this->config['or']; + $config['required'] = $this->config['required']; return parent::getConfig( $config ); } }