Page MenuHomeWickedGov Phorge

CitizenComponentLink.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

CitizenComponentLink.php

<?php
declare( strict_types=1 );
namespace MediaWiki\Skins\Citizen\Components;
use MediaWiki\Html\Html;
use MediaWiki\Linker\Linker;
use MessageLocalizer;
/**
* CitizenComponentLink component
*/
class CitizenComponentLink implements CitizenComponent {
public function __construct(
private readonly string $href,
private readonly string $text,
private readonly ?string $icon = null,
private readonly ?MessageLocalizer $localizer = null,
private readonly ?string $accessKeyHint = null
) {
}
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 [
'href' => $this->href,
'icon' => $this->icon,
'text' => $this->text,
'array-attributes' => [
[
'key' => 'href',
'value' => $this->href
]
],
'html-attributes' => $localizer && $accessKeyHint ? Html::expandAttributes(
Linker::tooltipAndAccesskeyAttribs(
$accessKeyHint,
[],
[],
$localizer
) + $additionalAttributes
) : '',
];
}
}

File Metadata

Mime Type
text/x-php
Expires
Wed, Aug 19, 11:47 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a7/6b/76e9515884cdaba723c4ac7ff256
Default Alt Text
CitizenComponentLink.php (1 KB)

Event Timeline