mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 07:43:47 +00:00
f6d45621bc
Bernard pointed out this is currently not used. Bug: T329794 Change-Id: Ia491c56f6cb57c93328d0e523d5c8aa634d92356
46 lines
815 B
PHP
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' => '',
|
|
];
|
|
}
|
|
}
|