X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fwidget%2FNamespaceInputWidget.php;h=3e86738bb3963eb81b8877bfe143ba532d61d5c4;hb=c66360d167aeacec8ec296ae8ff29fd5d3f1a557;hp=f10ea709e96616e6b791c2b103247eef7d5f6c0f;hpb=1e5391c1c957bb2383a7e98d79e0138239cfb616;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/widget/NamespaceInputWidget.php b/includes/widget/NamespaceInputWidget.php index f10ea709e9..3e86738bb3 100644 --- a/includes/widget/NamespaceInputWidget.php +++ b/includes/widget/NamespaceInputWidget.php @@ -8,106 +8,46 @@ namespace MediaWiki\Widget; /** - * Namespace input widget. Displays a dropdown box with the choice of available namespaces, plus two - * checkboxes to include associated namespace or to invert selection. + * Namespace input widget. Displays a dropdown box with the choice of available namespaces. */ -class NamespaceInputWidget extends \OOUI\Widget { +class NamespaceInputWidget extends \OOUI\DropdownInputWidget { - protected $namespace = null; - protected $associated = null; - protected $invert = null; - protected $allValue = null; + protected $includeAllValue = null; /** * @param array $config Configuration options - * @param string $config['nameNamespace'] HTML input name for the namespace dropdown box (default: - * 'namespace') - * @param string $config['nameInvert'] HTML input name for the "invert selection" checkbox. If - * null, the checkbox will not be generated. (default: 'invert') - * @param string $config['nameAssociated'] HTML input name for the "include associated namespace" - * checkbox. If null, the checkbox will not be generated. (default: 'associated') * @param string $config['includeAllValue'] If specified, add a "all namespaces" option to the * namespace dropdown, and use this as the input value for it - * @param int|string $config['valueNamespace'] Input value of the namespace dropdown box. May be a - * string only if 'includeAllValue' is set. - * @param boolean $config['valueInvert'] Input value of the "invert selection" checkbox (default: - * false) - * @param boolean $config['valueAssociated'] Input value of the "include associated namespace" - * checkbox (default: false) - * @param string $config['labelInvert'] Text of label to use for "invert selection" checkbox - * @param string $config['labelAssociated'] Text of label to use for "include associated - * namespace" checkbox + * @param number[] $config['exclude'] List of namespace numbers to exclude from the selector */ - public function __construct( array $config = array() ) { + public function __construct( array $config = [] ) { // Configuration initialization - $config = array_merge( - array( - 'nameNamespace' => 'namespace', - 'nameInvert' => 'invert', - 'nameAssociated' => 'associated', - // Choose first available: either main namespace or the "all namespaces" option - 'valueNamespace' => null, - 'valueInvert' => false, - 'valueAssociated' => false, - ), - $config - ); + $config['options'] = $this->getNamespaceDropdownOptions( $config ); // Parent constructor parent::__construct( $config ); // Properties - $this->allValue = isset( $config['includeAllValue'] ) ? $config['includeAllValue'] : null; - $this->namespace = new \OOUI\DropdownInputWidget( array( - 'name' => $config['nameNamespace'], - 'value' => $config['valueNamespace'], - 'options' => $this->getNamespaceDropdownOptions( $config ), - ) ); - if ( $config['nameAssociated'] !== null ) { - // FIXME Should use a LabelWidget? But they don't work like HTML