Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7408417
VectorComponentLink.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
VectorComponentLink.php
View Options
<?php
namespace
MediaWiki\Skins\Vector\Components
;
use
MediaWiki\Html\Html
;
use
MediaWiki\Linker\Linker
;
use
MessageLocalizer
;
/**
* VectorComponentLink component
*/
class
VectorComponentLink
implements
VectorComponent
{
/** @var MessageLocalizer */
private
$localizer
;
/** @var string */
private
$icon
;
/** @var string */
private
$href
;
/** @var string */
private
$text
;
/** @var string */
private
$accessKeyHint
;
/**
* @param string $href
* @param string $text
* @param null|string $icon
* @param null|MessageLocalizer $localizer for generation of tooltip and access keys
* @param null|string $accessKeyHint will be used to derive HTML attributes such as title, accesskey
* and aria-label ("$accessKeyHint-label")
*/
public
function
__construct
(
string
$href
,
string
$text
,
$icon
=
null
,
$localizer
=
null
,
$accessKeyHint
=
null
)
{
$this
->
href
=
$href
;
$this
->
text
=
$text
;
$this
->
icon
=
$icon
;
$this
->
localizer
=
$localizer
;
$this
->
accessKeyHint
=
$accessKeyHint
;
}
/**
* @inheritDoc
*/
public
function
getTemplateData
():
array
{
$localizer
=
$this
->
localizer
;
$accessKeyHint
=
$this
->
accessKeyHint
;
$additionalAttributes
=
[];
if
(
$localizer
)
{
$msg
=
$localizer
->
msg
(
$accessKeyHint
.
'-label'
);
if
(
$msg
->
exists
()
)
{
$additionalAttributes
[
'aria-label'
]
=
$msg
->
text
();
}
}
return
[
'icon'
=>
$this
->
icon
,
'text'
=>
$this
->
text
,
'href'
=>
$this
->
href
,
'html-attributes'
=>
$localizer
&&
$accessKeyHint
?
Html
::
expandAttributes
(
Linker
::
tooltipAndAccesskeyAttribs
(
$accessKeyHint
,
[],
[],
$localizer
)
+
$additionalAttributes
)
:
''
,
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 21, 21:32 (1 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b7/af/90ac3d37196c09aaeac1a2c8372a
Default Alt Text
VectorComponentLink.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment