Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6002014
EchoForeignPresentationModel.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
EchoForeignPresentationModel.php
View Options
<?php
namespace
MediaWiki\Extension\Notifications\Formatters
;
use
MediaWiki\Extension\Notifications\ForeignNotifications
;
use
MediaWiki\Language\RawMessage
;
class
EchoForeignPresentationModel
extends
EchoEventPresentationModel
{
/** @inheritDoc */
public
function
getIconType
()
{
return
'global'
;
}
/** @inheritDoc */
public
function
getPrimaryLink
()
{
return
false
;
}
/** @inheritDoc */
protected
function
getHeaderMessageKey
()
{
$data
=
$this
->
event
->
getExtra
();
$section
=
$data
[
'section'
]
==
'message'
?
'notice'
:
$data
[
'section'
];
// notification-header-foreign-alert
// notification-header-foreign-notice
// notification-header-foreign-all
return
"notification-header-foreign-{$section}"
;
}
/** @inheritDoc */
public
function
getHeaderMessage
()
{
$msg
=
parent
::
getHeaderMessage
();
$data
=
$this
->
event
->
getExtra
();
$firstWiki
=
reset
(
$data
[
'wikis'
]
);
$names
=
$this
->
getWikiNames
(
[
$firstWiki
]
);
$msg
->
params
(
$names
[
0
]
);
$msg
->
numParams
(
count
(
$data
[
'wikis'
]
)
-
1
);
$msg
->
numParams
(
count
(
$data
[
'wikis'
]
)
);
return
$msg
;
}
/** @inheritDoc */
public
function
getBodyMessage
()
{
$data
=
$this
->
event
->
getExtra
();
$msg
=
new
RawMessage
(
'$1'
);
$msg
->
params
(
$this
->
language
->
listToText
(
$this
->
getWikiNames
(
$data
[
'wikis'
]
)
)
);
return
$msg
;
}
/**
* @param string[] $wikis
* @return string[]
*/
protected
function
getWikiNames
(
array
$wikis
):
array
{
$data
=
ForeignNotifications
::
getApiEndpoints
(
$wikis
);
$names
=
[];
foreach
(
$wikis
as
$wiki
)
{
$names
[]
=
$data
[
$wiki
][
'title'
];
}
return
$names
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 4 2026, 06:39 (5 w, 21 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
7b/7d/5a7e9081b61653c3c39f56b5752c
Default Alt Text
EchoForeignPresentationModel.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment