Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5974822
HTMLSelectNamespace.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
HTMLSelectNamespace.php
View Options
<?php
namespace
MediaWiki\HTMLForm\Field
;
use
MediaWiki\Html\Html
;
use
MediaWiki\HTMLForm\HTMLFormField
;
/**
* Wrapper for Html::namespaceSelector to use in HTMLForm
*
* @stable to extend
*/
class
HTMLSelectNamespace
extends
HTMLFormField
{
/** @var string|null */
protected
$mAllValue
;
/** @var bool */
protected
$mUserLang
;
/** @var int[]|null */
protected
$mInclude
;
/**
* @stable to call
* @inheritDoc
*/
public
function
__construct
(
$params
)
{
parent
::
__construct
(
$params
);
$this
->
mAllValue
=
array_key_exists
(
'all'
,
$params
)
?
$params
[
'all'
]
:
'all'
;
$this
->
mUserLang
=
array_key_exists
(
'in-user-lang'
,
$params
)
?
$params
[
'in-user-lang'
]
:
false
;
$this
->
mInclude
=
array_key_exists
(
'include'
,
$params
)
?
$params
[
'include'
]
:
null
;
}
/**
* @inheritDoc
* @stable to override
*/
public
function
getInputHTML
(
$value
)
{
return
Html
::
namespaceSelector
(
[
'selected'
=>
$value
,
'all'
=>
$this
->
mAllValue
,
'in-user-lang'
=>
$this
->
mUserLang
,
'include'
=>
$this
->
mInclude
],
[
'name'
=>
$this
->
mName
,
'id'
=>
$this
->
mID
,
'class'
=>
'namespaceselector'
,
]
);
}
/**
* @inheritDoc
* @stable to override
*/
public
function
getInputOOUI
(
$value
)
{
return
new
\MediaWiki\Widget\NamespaceInputWidget
(
[
'value'
=>
$value
,
'name'
=>
$this
->
mName
,
'id'
=>
$this
->
mID
,
'includeAllValue'
=>
$this
->
mAllValue
,
'userLang'
=>
$this
->
mUserLang
,
'include'
=>
$this
->
mInclude
,
]
);
}
/**
* @inheritDoc
* @stable to override
*/
public
function
getInputCodex
(
$value
,
$hasErrors
)
{
$optionParams
=
[
'all'
=>
$this
->
mAllValue
,
'in-user-lang'
=>
$this
->
mUserLang
];
$select
=
new
HTMLSelectField
(
[
'options'
=>
array_flip
(
Html
::
namespaceSelectorOptions
(
$optionParams
)
)
]
+
$this
->
mParams
);
return
$select
->
getInputCodex
(
$value
,
$hasErrors
);
}
/**
* @inheritDoc
* @stable to override
*/
protected
function
getOOUIModules
()
{
// FIXME: NamespaceInputWidget should be in its own module (probably?)
return
[
'mediawiki.widgets'
];
}
/**
* @inheritDoc
* @stable to override
*/
protected
function
shouldInfuseOOUI
()
{
return
true
;
}
}
/** @deprecated class alias since 1.42 */
class_alias
(
HTMLSelectNamespace
::
class
,
'HTMLSelectNamespace'
);
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 17:45 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b9/54/ece041dbd6a5511fc8daec66378f
Default Alt Text
HTMLSelectNamespace.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment