Skip to content

Commit

Permalink
Add skin-wide custom indicators (experimental)
Browse files Browse the repository at this point in the history
  • Loading branch information
lakejason0 committed Jun 20, 2024
1 parent 5783ca6 commit e1f9e9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions includes/SkinLakeus.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ public function getTemplateData(): array {
unset( $data["data-toc"] );
}

$customIndicators = $config->get( 'LakeusCustomIndicators' );
$idTracker = [];
foreach ( $data["array-indicators"] as $item ) {
$idTracker[$item["id"]] = true;
}
foreach ( $customIndicators as $indicator ) {
if ( !isset( $idTracker[ $indicator["id"] ] ) ) {
$data["array-indicators"][] = $indicator;
$idTracker[ $indicator["id"] ] = true;
}
};

return $data;
}
}
4 changes: 4 additions & 0 deletions skin.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@
"LakeusShowStickyTOC": {
"value": false,
"description": "Whether to show sticky TOC."
},
"LakeusCustomIndicators": {
"value": [],
"description": "Add custom skin-wide indicators. This is PROBABLY NOT how you should add page status indicators and therefore experimental. This array should contain objects with `id` `class` `html` properties."
}
},
"manifest_version": 2
Expand Down

0 comments on commit e1f9e9d

Please sign in to comment.