diff --git a/includes/SkinVector.php b/includes/SkinVector.php index 4590b294..259d5bdb 100644 --- a/includes/SkinVector.php +++ b/includes/SkinVector.php @@ -639,6 +639,7 @@ class SkinVector extends SkinMustache { Constants::FEATURE_STICKY_HEADER_EDIT ) ) : false, + 'data-toc' => $this->getTocData( $parentData['data-toc'] ?? [] ) ] ); if ( !$this->isTableOfContentsVisibleInSidebar() ) { @@ -696,6 +697,25 @@ class SkinVector extends SkinMustache { return $commonSkinData; } + /** + * Annotates table of contents data with Vector-specific information. + * + * @param array $tocData + * @return array + */ + private function getTocData( array $tocData ): array { + if ( empty( $tocData ) ) { + return []; + } + + return array_merge( $tocData, [ + 'vector-is-collapse-sections-enabled' => + $tocData[ 'number-section-count'] >= $this->getConfig()->get( + 'VectorTableOfContentsCollapseAtCount' + ) + ] ); + } + /** * Annotates search box with Vector-specific information * diff --git a/includes/templates/TableOfContents__topSection.mustache b/includes/templates/TableOfContents__topSection.mustache index 6beffacb..107f088e 100644 --- a/includes/templates/TableOfContents__topSection.mustache +++ b/includes/templates/TableOfContents__topSection.mustache @@ -1,4 +1,4 @@ -