| 1 | <?php |
| 2 | namespace MediaWiki\Skins\Vector\Components; |
| 3 | |
| 4 | /** |
| 5 | * VectorComponentPinnableContainer component |
| 6 | * To be used with PinnableContainer/Pinned or PinnableContainer/Unpinned templates. |
| 7 | */ |
| 8 | class VectorComponentPinnableContainer implements VectorComponent { |
| 9 | /** @var string */ |
| 10 | private $id; |
| 11 | /** @var bool */ |
| 12 | private $isPinned; |
| 13 | |
| 14 | /** |
| 15 | * @param string $id |
| 16 | * @param bool $isPinned |
| 17 | */ |
| 18 | public function __construct( string $id, bool $isPinned = true ) { |
| 19 | $this->id = $id; |
| 20 | $this->isPinned = $isPinned; |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * @inheritDoc |
| 25 | */ |
| 26 | public function getTemplateData(): array { |
| 27 | return [ |
| 28 | 'id' => $this->id, |
| 29 | 'is-pinned' => $this->isPinned, |
| 30 | ]; |
| 31 | } |
| 32 | } |