mediawiki-skins-Citizen/tests/phpunit/Unit/Components/CitizenComponentMenuListItemTest.php
alistair3149 03da361b97
feat(components): rewrite template data partials into CitizenComponent components (#846)
- Refactor existing template data-related partials into CitizenComponent components
- Re-implement user menu header as UserInfo
- Add description text for anon and temp user in UserMenu
---------

Co-authored-by: github-actions <github-actions@users.noreply.github.com>
2024-05-15 01:24:43 -04:00

39 lines
767 B
PHP

<?php
declare( strict_types=1 );
namespace MediaWiki\Skins\Citizen\Components;
/**
* CitizenComponentMenuListItem component
*/
class CitizenComponentMenuListItem implements CitizenComponent {
/** @var CitizenComponentLink */
private $link;
/** @var string */
private $class;
/** @var string */
private $id;
/**
* @param CitizenComponentLink $link
* @param string $class
* @param string $id
*/
public function __construct( CitizenComponentLink $link, string $class = '', string $id = '' ) {
$this->link = $link;
$this->class = $class;
$this->id = $id;
}
/**
* @inheritDoc
*/
public function getTemplateData(): array {
return $this->link->getTemplateData() + [
'item-class' => $this->class,
'item-id' => $this->id,
];
}
}