aboutsummaryrefslogtreecommitdiffstats
path: root/includes/htmlform/fields/HTMLSelectNamespace.php
diff options
context:
space:
mode:
authorSTran <stran@wikimedia.org>2024-10-29 07:32:00 -0700
committerSTran <stran@wikimedia.org>2024-10-30 09:07:22 -0700
commit5617115fe22337ba464bd6b253c1d2af941b2adc (patch)
tree322bd65bfc0567edccde4dd1b22ca1e2a1d95048 /includes/htmlform/fields/HTMLSelectNamespace.php
parente438c515bf9390dcb8cb2049298deb0f087439bb (diff)
downloadmediawikicore-5617115fe22337ba464bd6b253c1d2af941b2adc.tar.gz
mediawikicore-5617115fe22337ba464bd6b253c1d2af941b2adc.zip
Support 'include' parameter in namespace select inputs
Namespace select inputs already support an 'exclude' parameter, ignoring any namespaces that match ids in that array. For Special:GlobalContributions, it would be useful to have the opposite - an array of namespaces to be included, as it only wants to support filtering on common namespaces. - Allow an 'include' parameter to be passed through to the namespace select input - Support 'include' in Html inputs and OOUI inputs TODO: Support 'include in Codex inputs (see T378582) Bug: T378179 Change-Id: I4170beb588292fbec26926ca3afe559c25de9f55
Diffstat (limited to 'includes/htmlform/fields/HTMLSelectNamespace.php')
-rw-r--r--includes/htmlform/fields/HTMLSelectNamespace.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/htmlform/fields/HTMLSelectNamespace.php b/includes/htmlform/fields/HTMLSelectNamespace.php
index 9ef9eac577e0..ee2ec9953f15 100644
--- a/includes/htmlform/fields/HTMLSelectNamespace.php
+++ b/includes/htmlform/fields/HTMLSelectNamespace.php
@@ -16,6 +16,8 @@ class HTMLSelectNamespace extends HTMLFormField {
protected $mAllValue;
/** @var bool */
protected $mUserLang;
+ /** @var int[]|null */
+ protected $mInclude;
/**
* @stable to call
@@ -30,6 +32,10 @@ class HTMLSelectNamespace extends HTMLFormField {
$this->mUserLang = array_key_exists( 'in-user-lang', $params )
? $params['in-user-lang']
: false;
+
+ $this->mInclude = array_key_exists( 'include', $params )
+ ? $params['include']
+ : null;
}
/**
@@ -42,6 +48,7 @@ class HTMLSelectNamespace extends HTMLFormField {
'selected' => $value,
'all' => $this->mAllValue,
'in-user-lang' => $this->mUserLang,
+ 'include' => $this->mInclude
], [
'name' => $this->mName,
'id' => $this->mID,
@@ -61,6 +68,7 @@ class HTMLSelectNamespace extends HTMLFormField {
'id' => $this->mID,
'includeAllValue' => $this->mAllValue,
'userLang' => $this->mUserLang,
+ 'include' => $this->mInclude,
] );
}