Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6044703
CitizenComponentSearchBox.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
CitizenComponentSearchBox.php
View Options
<?php
declare
(
strict_types
=
1
);
namespace
MediaWiki\Skins\Citizen\Components
;
use
MediaWiki\Registration\ExtensionRegistry
;
use
MediaWiki\Skin\SkinComponentUtils
;
use
MessageLocalizer
;
/**
* CitizenComponentSearchBox component
*/
class
CitizenComponentSearchBox
implements
CitizenComponent
{
public
function
__construct
(
private
MessageLocalizer
$localizer
,
private
ExtensionRegistry
$extensionRegistry
,
private
array
$searchBoxData
)
{
}
/**
* Get the keyboard hint data
*/
private
function
getKeyboardHintData
():
array
{
$data
=
[];
// There is probably a cleaner way to handle this
$map
=
[
'↑ ↓'
=>
$this
->
localizer
->
msg
(
"citizen-search-keyhint-select"
)->
text
(),
'/'
=>
$this
->
localizer
->
msg
(
"citizen-search-keyhint-open"
)->
text
(),
'Esc'
=>
$this
->
localizer
->
msg
(
"citizen-search-keyhint-exit"
)->
text
()
];
foreach
(
$map
as
$key
=>
$label
)
{
$keyhint
=
new
CitizenComponentKeyboardHint
(
$label
,
$key
);
$data
[]
=
$keyhint
->
getTemplateData
();
}
return
$data
;
}
/**
* Get the footer message
*/
private
function
getFooterMessage
():
string
{
$isCirrusSearchExtensionEnabled
=
$this
->
extensionRegistry
->
isLoaded
(
'CirrusSearch'
);
$searchBackend
=
$isCirrusSearchExtensionEnabled
?
'cirrussearch'
:
'mediawiki'
;
return
$this
->
localizer
->
msg
(
'citizen-search-poweredby'
,
$this
->
localizer
->
msg
(
"citizen-search-poweredby-$searchBackend"
)
)->
text
();
}
/**
* @inheritDoc
*/
public
function
getTemplateData
():
array
{
$searchBoxData
=
$this
->
searchBoxData
+
[
'array-keyboard-hint'
=>
$this
->
getKeyboardHintData
(),
'msg-citizen-search-footer'
=>
$this
->
getFooterMessage
(),
'msg-citizen-search-toggle-shortcut'
=>
'[/]'
,
'html-random-href'
=>
SkinComponentUtils
::
makeSpecialUrl
(
'Randompage'
)
];
return
$searchBoxData
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 4 2026, 21:29 (5 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2e/6d/82c6c8ef5cb5987c2fa395abea6d
Default Alt Text
CitizenComponentSearchBox.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment