mediawiki-skins-Vector/includes/Components/VectorComponentMenu.php
Jon Robson f6d45621bc Drop unused template and associated code
Bernard pointed out this is currently not used.

Bug: T329794
Change-Id: Ia491c56f6cb57c93328d0e523d5c8aa634d92356
2023-03-09 10:53:33 -08:00

46 lines
815 B
PHP

<?php
namespace MediaWiki\Skins\Vector\Components;
use Countable;
/**
* VectorComponentMenu component
*/
class VectorComponentMenu implements VectorComponent, Countable {
/** @var array */
private $data;
/**
* @param array $data
*/
public function __construct( array $data ) {
$this->data = $data;
}
/**
* Counts how many items the menu has.
*
* @return int
*/
public function count(): int {
$htmlItems = $this->data['html-items'] ?? '';
return substr_count( $htmlItems, '<li' );
}
/**
* @inheritDoc
*/
public function getTemplateData(): array {
return $this->data + [
'class' => '',
'label' => '',
'html-tooltip' => '',
'label-class' => '',
'heading-class' => '',
'html-before-portal' => '',
'html-items' => '',
'html-after-portal' => '',
];
}
}