mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 07:43:47 +00:00
Setup placeholder components to guide future development
As we build out these components further we should be encouraging using the component system rather than the SkinVector function calls. This allows us a way to gradually move code over as needed. Bug: T322089 Change-Id: I7b38ae5b6fe2aa42759ae482e7647a26fcedfc38
This commit is contained in:
parent
7a8ad95bcf
commit
dba4fa6265
15
includes/Components/VectorComponentStickyHeader.php
Normal file
15
includes/Components/VectorComponentStickyHeader.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
namespace MediaWiki\Skins\Vector\Components;
|
||||
|
||||
/**
|
||||
* VectorComponentStickyHeader component
|
||||
*/
|
||||
class VectorComponentStickyHeader implements VectorComponent {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getTemplateData(): array {
|
||||
return [];
|
||||
}
|
||||
}
|
15
includes/Components/VectorComponentTableOfContents.php
Normal file
15
includes/Components/VectorComponentTableOfContents.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
namespace MediaWiki\Skins\Vector\Components;
|
||||
|
||||
/**
|
||||
* VectorComponentTableOfContents component
|
||||
*/
|
||||
class VectorComponentTableOfContents implements VectorComponent {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getTemplateData(): array {
|
||||
return [];
|
||||
}
|
||||
}
|
|
@ -346,6 +346,7 @@ abstract class SkinVector extends SkinMustache {
|
|||
|
||||
/**
|
||||
* Generate data needed to generate the sticky header.
|
||||
* FIXME: Move to VectorComponentStickyHeader
|
||||
* @param array $searchBoxData
|
||||
* @param bool $includeEditIcons
|
||||
* @return array
|
||||
|
|
|
@ -7,6 +7,8 @@ use MediaWiki\Skins\Vector\Components\VectorComponentMainMenu;
|
|||
use MediaWiki\Skins\Vector\Components\VectorComponentPageTools;
|
||||
use MediaWiki\Skins\Vector\Components\VectorComponentPinnableHeader;
|
||||
use MediaWiki\Skins\Vector\Components\VectorComponentSearchBox;
|
||||
use MediaWiki\Skins\Vector\Components\VectorComponentStickyHeader;
|
||||
use MediaWiki\Skins\Vector\Components\VectorComponentTableOfContents;
|
||||
|
||||
/**
|
||||
* @ingroup Skins
|
||||
|
@ -109,6 +111,7 @@ class SkinVector22 extends SkinVector {
|
|||
*
|
||||
* In tableOfContents.js we have tableOfContents::getTableOfContentsSectionsData(),
|
||||
* that yields the same result as this function, please make sure to keep them in sync.
|
||||
* FIXME: This code should be moved to VectorComponentTableOfContents.
|
||||
*
|
||||
* @param array $tocData
|
||||
* @return array
|
||||
|
@ -247,12 +250,11 @@ class SkinVector22 extends SkinVector {
|
|||
public function getTemplateData(): array {
|
||||
$featureManager = VectorServices::getFeatureManager();
|
||||
$parentData = parent::getTemplateData();
|
||||
$stickyHeader = new VectorComponentStickyHeader();
|
||||
$toc = new VectorComponentTableOfContents();
|
||||
$parentData['data-toc'] = $this->isTableOfContentsVisibleInSidebar() ?
|
||||
$toc->getTemplateData() + $this->getTocData( $parentData['data-toc'] ?? [] ) : null;
|
||||
|
||||
$parentData['data-toc'] = $this->getTocData( $parentData['data-toc'] ?? [] );
|
||||
|
||||
if ( !$this->isTableOfContentsVisibleInSidebar() ) {
|
||||
unset( $parentData['data-toc'] );
|
||||
}
|
||||
$parentData = $this->mergeViewOverflowIntoActions( $parentData );
|
||||
|
||||
// FIXME: Move to component (T322089)
|
||||
|
@ -351,7 +353,7 @@ class SkinVector22 extends SkinVector {
|
|||
'data-page-titlebar-toc' => $this->getTocPageTitleData(),
|
||||
'data-vector-sticky-header' => $featureManager->isFeatureEnabled(
|
||||
Constants::FEATURE_STICKY_HEADER
|
||||
) ? $this->getStickyHeaderData(
|
||||
) ? $stickyHeader->getTemplateData() + $this->getStickyHeaderData(
|
||||
$searchStickyHeader->getTemplateData(),
|
||||
$featureManager->isFeatureEnabled(
|
||||
Constants::FEATURE_STICKY_HEADER_EDIT
|
||||
|
|
Loading…
Reference in a new issue