Merge "Never show an empty table of contents"

This commit is contained in:
jenkins-bot 2022-03-18 20:17:14 +00:00 committed by Gerrit Code Review
commit 0b6905b7e0
1 changed files with 3 additions and 1 deletions

View File

@ -682,7 +682,9 @@ class SkinVector extends SkinMustache {
* @return array
*/
private function getTocData( array $tocData ): array {
if ( empty( $tocData ) ) {
// If the table of contents has no items, we won't output it.
// empty array is interpreted by Mustache as falsey.
if ( empty( $tocData ) || empty( $tocData[ 'array-sections' ] ) ) {
return [];
}