mediawiki-skins-Vector/includes/Components/VectorComponentMenuListItem.php
Jon Robson e153561255 Component: UserLinks
Simplify the user links component
Introduce MenuListItem and IconLink components.

HTML changes:
* Logout, login and account links are now wrapped in a ul and li tag
instead of a DIV for consistent with other menus (this occurs due
to use of MenuContents). Code reviewer can see tests
for an understanding of how the template data and markup has changed.

VISUAL CHANGE:
* Increased margins in user links menu relating to change from DIV to
UL / LI tags.

Bug: T320927
Change-Id: Ia24be48105e1ff85da227883abb5dddb3d54388d
2023-01-11 21:48:11 +00:00

35 lines
724 B
PHP

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