Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5969444
OverflowMenuItem.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
OverflowMenuItem.php
View Options
<?php
namespace
MediaWiki\Extension\DiscussionTools
;
use
JsonSerializable
;
/**
* Item to go into the DiscussionTools overflow menu, as an OO.ui.MenuOptionWidget object.
*/
class
OverflowMenuItem
implements
JsonSerializable
{
private
string
$icon
;
private
string
$label
;
private
array
$data
;
private
string
$id
;
private
int
$weight
;
/**
* @param string $id A unique identifier for the menu item, e.g. 'edit' or 'reportincident'
* @param string $icon An OOUI icon name.
* @param string $label A rendered string to use as the label for the item.
* @param int $weight Sorting weight. Higher values will push the item further up the menu.
* @param array $data Data to include with the menu item. Will be accessible via getData() on the
* OOUI MenuOptionWidget in client-side code.
*/
public
function
__construct
(
string
$id
,
string
$icon
,
string
$label
,
int
$weight
=
0
,
array
$data
=
[]
)
{
$this
->
id
=
$id
;
$this
->
icon
=
$icon
;
$this
->
label
=
$label
;
$this
->
weight
=
$weight
;
$this
->
data
=
$data
;
}
public
function
jsonSerialize
():
array
{
$data
=
$this
->
data
;
// Add 'id' into the 'data' array, for easier access with OOUI's getData() method
$data
[
'id'
]
=
$this
->
id
;
return
[
'id'
=>
$this
->
id
,
'data'
=>
$data
,
'icon'
=>
$this
->
icon
,
'label'
=>
$this
->
label
,
];
}
public
function
getId
():
string
{
return
$this
->
id
;
}
public
function
getWeight
():
int
{
return
$this
->
weight
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 13:46 (1 d, 8 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
45/fd/6c35a7f2f08c2624301b956ff0c5
Default Alt Text
OverflowMenuItem.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment